]> git.pld-linux.org Git - packages/mythtv.git/blob - mythbackend.init
- updated python BRs
[packages/mythtv.git] / mythbackend.init
1 #!/bin/sh
2 #
3 # mythbackend   Server component of MythTV
4 #
5 # chkconfig: 2345 86 14
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.
9 # processname: mythbackend
10 # pidfile: /var/run/mythtv/mythbackend.pid
11 # config: /etc/sysconfig/mythbackend
12
13 # Source function library.
14 . /etc/rc.d/init.d/functions
15
16 MYTHTV_USER=mythtv
17 OPTIONS=
18
19 if [ -f /etc/sysconfig/mythbackend ]; then
20         . /etc/sysconfig/mythbackend
21 fi
22
23 pidfile=/var/run/mythtv/mythbackend.pid
24
25 start() {
26         # Start daemons.
27         if [ -f /var/lock/subsys/mythbackend ]; then
28                 msg_already_running "Mythbackend"
29                 return
30         fi
31
32         msg_starting "Mythbackend"
33         daemon /usr/sbin/mythbackend --daemon \
34                 --user $MYTHTV_USER \
35                 --logfile /var/log/mythtv/mythbackend.log \
36                 --pidfile $pidfile \
37                 $OPTIONS
38         RETVAL=$?
39         [ $RETVAL -eq 0 ] && touch /var/lock/subsys/mythbackend
40 }
41
42 stop() {
43         # Stop daemons.
44         if [ ! -f /var/lock/subsys/mythbackend ]; then
45                 msg_not_running "Mythbackend"
46                 return
47         fi
48
49         msg_stopping "Mythbackend"
50         killproc --pidfile mythtv/mythbackend.pid mythbackend
51         rm -f /var/lock/subsys/mythbackend $pidfile >/dev/null 2>&1
52 }
53
54 condrestart() {
55         if [ ! -f /var/lock/subsys/mythbackend ]; then
56                 msg_not_running "Mythbackend"
57                 RETVAL=$1
58                 return
59         fi
60
61         stop
62         start
63 }
64
65 flush-logs() {
66         if [ ! -f /var/lock/subsys/mythbackend ]; then
67                 return
68         fi
69
70         show "Rotating %s logs" "Mythbackend"
71         killproc --pidfile $pidfile mythbackend -HUP
72 }
73
74 RETVAL=0
75 # See how we were called.
76 case "$1" in
77   start)
78         start
79         ;;
80   stop)
81         stop
82         ;;
83   restart)
84         stop
85         start
86         ;;
87   try-restart)
88         condrestart 0
89         ;;
90   force-reload)
91         condrestart 7
92         ;;
93   flush-logs)
94         flush-logs
95         ;;
96   status)
97         status --pidfile $pidfile mythbackend
98         ;;
99   *)
100         msg_usage "$0 {start|stop|restart|try-restart|force-reload|flush-logs|status}"
101         exit 3
102 esac
103
104 exit $RETVAL
This page took 0.032299 seconds and 3 git commands to generate.