]> git.pld-linux.org Git - packages/tvheadend.git/blob - tvheadend.init
- release 3 (by relup.sh)
[packages/tvheadend.git] / tvheadend.init
1 #!/bin/sh
2 #
3 # tvheadend     tvheadend tv streaming service
4 #
5 # chkconfig:    345 40 60
6 #
7 # description:  tvheadend tv streaming service
8 #
9 # processname:  tvheadend
10 #
11
12 # Source function library
13 . /etc/rc.d/init.d/functions
14
15 # Get network config
16 . /etc/sysconfig/network
17
18 # Check that networking is up.
19 if is_yes "${NETWORKING}"; then
20         if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
21                 msg_network_down "tvheadend"
22                 exit 1
23         fi
24 else
25         exit 0
26 fi
27
28 # Set defaults
29 TVHEADEND_ARGS=""
30
31 # Get service config - may override defaults
32 [ -f /etc/sysconfig/tvheadend ] && . /etc/sysconfig/tvheadend
33
34 start() {
35         # Check if the service is already running?
36         if [ -f /var/lock/subsys/tvheadend ]; then
37                 msg_already_running "tvheadend"
38                 return
39         fi
40
41         msg_starting "tvheadend"
42         daemon /usr/bin/tvheadend -f -u tvheadend -g video $TVHEADEND_ARGS
43         RETVAL=$?
44         [ $RETVAL -eq 0 ] && touch /var/lock/subsys/tvheadend
45 }
46
47 stop() {
48         if [ ! -f /var/lock/subsys/tvheadend ]; then
49                 msg_not_running "tvheadend"
50                 return
51         fi
52
53         # Stop daemons.
54         msg_stopping "tvheadend"
55         killproc tvheadend
56         rm -f /var/lock/subsys/tvheadend
57 }
58
59 condrestart() {
60         if [ ! -f /var/lock/subsys/tvheadend ]; then
61                 msg_not_running "tvheadend"
62                 RETVAL=$1
63                 return
64         fi
65
66         stop
67         start
68 }
69
70 RETVAL=0
71 # See how we were called.
72 case "$1" in
73   start)
74         start
75         ;;
76   stop)
77         stop
78         ;;
79   restart)
80         stop
81         start
82         ;;
83   try-restart)
84         condrestart 0
85         ;;
86   force-reload)
87         condrestart 7
88         ;;
89   status)
90         status tvheadend
91         RETVAL=$?
92         ;;
93   *)
94         msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"
95         exit 3
96 esac
97
98 exit $RETVAL
This page took 0.02959 seconds and 3 git commands to generate.