Ticket #7580: my.rc.2.backend

File my.rc.2.backend, 1.1 KB (added by anonymous, 14 years ago)
Line 
1#!/bin/sh
2# made for slackware by Kemble Wagner but should work on any distro
3#if mythbackend starting on startup with problems like below
4# e.g +environment variable HOME or MYTHCONFDIR
5# Failed to init MythContext, exiting
6# then uncomment the line below to export you myth users home folder make sure you edit the path
7# export MYTHCONFDIR=/home/user/.mythtv
8#modify your mythbackend prefix path
9MYTHBACKEND=/usr/local/bin/mythbackend
10BACKENDLOG=/var/log/backend.log
11PID=/var/run/mythtv/mythbackend.pid
12
13
14mythbackend_start(){
15if ! ps axc | grep mythbackend 1> /dev/null 2> /dev/null; then
16echo  "Starting mythbackend"
17        $MYTHBACKEND -l $BACKENDLOG -v important,general -p $PID -d
18else
19echo  "mythbackend already running"
20 fi 
21}
22mythbackend_stop(){
23        echo  "Stopping mythbackend"
24        killall -9 mythbackend
25}
26
27mythbackend_restart(){
28        mythbackend_stop
29        sleep 2
30        mythbackend_start
31}
32case "$1" in
33        'start')
34        mythbackend_start
35        ;;
36
37        'stop')
38        mythbackend_stop
39        ;;
40
41        'restart')
42        mythbackend_restart
43        ;;
44
45        *)
46        echo "usage $0 start|stop|restart"
47esac
48