]>
Commit | Line | Data |
---|---|---|
02f42b3d | 1 | #!/bin/sh |
89940d82 | 2 | # |
02f42b3d | 3 | # mythbackend Server component of MythTV |
89940d82 | 4 | # |
02f42b3d | 5 | # chkconfig: 2345 86 14 |
3c5a5851 ER |
6 | # description: Starts the mythbackend process as a daemon after the XWindows \ |
7 | # system is started, in runlevel 5. This allows scheduled \ | |
8 | # recordings to occur without manual intervention. | |
89940d82 | 9 | # processname: mythbackend |
3c5a5851 | 10 | # pidfile: /var/run/mythtv/mythbackend.pid |
89940d82 ER |
11 | # config: /etc/sysconfig/mythbackend |
12 | ||
13 | # Source function library. | |
14 | . /etc/rc.d/init.d/functions | |
15 | ||
16 | if [ -f /etc/sysconfig/mythbackend ]; then | |
17 | . /etc/sysconfig/mythbackend | |
18 | fi | |
19 | ||
f2206327 | 20 | pidfile=/var/run/mythtv/mythbackend.pid |
89940d82 | 21 | |
04283632 | 22 | start() { |
89940d82 | 23 | # Start daemons. |
93ffc3a9 | 24 | if [ -f /var/lock/subsys/mythbackend ]; then |
89940d82 | 25 | msg_already_running "Mythbackend" |
93ffc3a9 | 26 | return |
89940d82 | 27 | fi |
93ffc3a9 ER |
28 | |
29 | msg_starting "Mythbackend" | |
30 | daemon /usr/sbin/mythbackend --daemon \ | |
31 | --user mythtv \ | |
32 | --logfile /var/log/mythtv/mythbackend.log \ | |
33 | --pidfile $pidfile \ | |
34 | $OPTIONS | |
35 | RETVAL=$? | |
36 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/mythbackend | |
04283632 ER |
37 | } |
38 | ||
39 | stop() { | |
89940d82 | 40 | # Stop daemons. |
93ffc3a9 | 41 | if [ ! -f /var/lock/subsys/mythbackend ]; then |
89940d82 | 42 | msg_not_running "Mythbackend" |
93ffc3a9 ER |
43 | return |
44 | fi | |
45 | ||
46 | msg_stopping "Mythbackend" | |
47 | killproc --pidfile mythtv/mythbackend.pid mythbackend | |
48 | rm -f /var/lock/subsys/mythbackend $pidfile >/dev/null 2>&1 | |
49 | } | |
50 | ||
51 | flush-logs() { | |
52 | if [ ! -f /var/lock/subsys/mythbackend ]; then | |
53 | return | |
89940d82 | 54 | fi |
93ffc3a9 ER |
55 | |
56 | show "Rotating %s logs" "Mythbackend" | |
57 | killproc --pidfile $pidfile mythbackend -HUP | |
04283632 ER |
58 | } |
59 | ||
60 | RETVAL=0 | |
61 | # See how we were called. | |
62 | case "$1" in | |
93ffc3a9 | 63 | start) |
04283632 ER |
64 | start |
65 | ;; | |
93ffc3a9 | 66 | stop) |
04283632 ER |
67 | stop |
68 | ;; | |
93ffc3a9 | 69 | restart) |
04283632 ER |
70 | stop |
71 | start | |
72 | ;; | |
93ffc3a9 ER |
73 | flush-logs) |
74 | flush-logs | |
75 | ;; | |
76 | status) | |
77 | status --pidfile $pidfile mythbackend | |
02f42b3d | 78 | ;; |
93ffc3a9 | 79 | *) |
89940d82 ER |
80 | msg_usage "$0 {start|stop|restart|reload|force-reload|status}" |
81 | exit 3 | |
82 | esac | |
83 | ||
84 | exit $RETVAL |