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 |
|
---|
9 |
|
---|
10 |
|
---|
11 | mythbackend_start(){
|
---|
12 | if ! ps axc | grep mythbackend 1> /dev/null 2> /dev/null; then
|
---|
13 | echo "Starting mythbackend"
|
---|
14 | /usr/local/bin/mythbackend -l /var/log/backend.log -v important,general -p /var/run/mythtv/mythbackend.pid -d
|
---|
15 | else
|
---|
16 | echo "mythbackend already running"
|
---|
17 | fi
|
---|
18 | }
|
---|
19 | mythbackend_stop(){
|
---|
20 | echo "Stopping mythbackend"
|
---|
21 | /bin/killall -9 mythbackend
|
---|
22 | }
|
---|
23 |
|
---|
24 | mythbackend_restart(){
|
---|
25 | mythbackend_stop
|
---|
26 | /usr/bin/sleep 2
|
---|
27 | mythbackend_start
|
---|
28 | }
|
---|
29 | case "$1" in
|
---|
30 | 'start')
|
---|
31 | mythbackend_start
|
---|
32 | ;;
|
---|
33 |
|
---|
34 | 'stop')
|
---|
35 | mythbackend_stop
|
---|
36 | ;;
|
---|
37 |
|
---|
38 | 'restart')
|
---|
39 | mythbackend_restart
|
---|
40 | ;;
|
---|
41 |
|
---|
42 | *)
|
---|
43 | echo "usage $0 start|stop|restart"
|
---|
44 | esac
|
---|
45 |
|
---|