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 |
---|
9 | MYTHBACKEND=/usr/local/bin/mythbackend |
---|
10 | BACKENDLOG=/var/log/backend.log |
---|
11 | PID=/var/run/mythtv/mythbackend.pid |
---|
12 | |
---|
13 | |
---|
14 | mythbackend_start(){ |
---|
15 | if ! ps axc | grep mythbackend 1> /dev/null 2> /dev/null; then |
---|
16 | echo "Starting mythbackend" |
---|
17 | $MYTHBACKEND -l $BACKENDLOG -v important,general -p $PID -d |
---|
18 | else |
---|
19 | echo "mythbackend already running" |
---|
20 | fi |
---|
21 | } |
---|
22 | mythbackend_stop(){ |
---|
23 | echo "Stopping mythbackend" |
---|
24 | killall -9 mythbackend |
---|
25 | } |
---|
26 | |
---|
27 | mythbackend_restart(){ |
---|
28 | mythbackend_stop |
---|
29 | sleep 2 |
---|
30 | mythbackend_start |
---|
31 | } |
---|
32 | case "$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" |
---|
47 | esac |
---|
48 | |
---|