updated on Thu Jan 12 16:09:17 UTC 2012
[aur-mirror.git] / hts-tvheadend / rc-tvheadend
blob0bb15c80f961c5c0f7a1a1a412bdec41aeb410e2
1 #!/bin/bash
3 # HTS Tvheadend daemon rc-script
6 daemon_name=tvheadend
7 pidfile=/var/run/$daemon_name.pid
9 . /etc/conf.d/tvheadend
10 . /etc/rc.conf
11 . /etc/rc.d/functions
13 case "$1" in
14 start)
15 stat_busy "Starting Tvheadend daemon"
16 if [ -z `pidof -o %PPID /usr/bin/$daemon_name` ]; then
17 [ -f ${pidfile} ] && rm -f ${pidfile}
18 # RUN
19 nice -n -1 /usr/bin/$daemon_name $daemon_args
21 if [ $? -gt 0 ]; then
22 stat_fail
23 exit 1
24 else
25 add_daemon $daemon_name
26 stat_done
28 else
29 stat_fail
30 exit 1
34 stop)
35 stat_busy "Stopping Tvheadend daemon"
36 # KILL
37 [ -f ${pidfile} ] && kill `cat ${pidfile}` >/dev/null 2>&1
39 if [ $? -gt 0 ]; then
40 stat_fail
41 exit 1
42 else
43 rm -f ${pidfile}
44 rm_daemon $daemon_name
45 stat_done
49 restart)
50 $0 stop
51 sleep 3
52 $0 start
55 echo "usage: $0 {start|stop|restart}"
56 esac
58 exit 0