updated on Thu Jan 26 16:09:46 UTC 2012
[aur-mirror.git] / open-sasc-ng / sasc-ng.rc
blob1b2e38c1946cf68c36d7793292e4b5af9132cdfa
1 #!/bin/bash
3 . /etc/rc.conf
4 . /etc/rc.d/functions
6 [ -f /etc/conf.d/sasc-ng ] && . /etc/conf.d/sasc-ng
8 PID=$(pidof -o %PPID /usr/sbin/sasc-ng)
10 case $1 in
11 start)
12 stat_busy "Loading dvbloopback kernel module"
14 [[ -z $DVBLOOPBACK_ARGS ]] && stat_die 1
16 modprobe dvbloopback $DVBLOOPBACK_ARGS
17 sleep 1
19 stat_done
21 stat_busy "Starting SASC-NG daemon"
23 [[ -z $SASCNG_ARGS ]] && stat_die 2
24 [[ -z $CAMDIR ]] && stat_die 3
25 [[ -z $LOGDIR ]] && stat_die 4
27 [[ -z $PID ]] && /usr/sbin/sasc-ng -D $SASCNG_ARGS --cam-dir=$CAMDIR -l $LOGDIR/sasc-ng.log
29 if [ $? -gt 0 ]; then
30 stat_die 5
31 else
32 add_daemon sasc-ng
33 stat_done
36 stop)
37 stat_busy "Stoping SASC-NG daemon"
38 [[ ! -z $PID ]] && kill $PID &> /dev/null
40 if [ $? -gt 0 ]; then
41 stat_die 6
42 else
43 rm_daemon sasc-ng
44 stat_done
47 stat_busy "Unloading dvbloopback kernel module"
49 sleep 2
50 modprobe -r dvbloopback
52 stat_done
55 restart)
56 $0 stop
57 sleep 1
58 $0 start
62 echo "usage: $0 {start|stop|restart}" >&2
63 exit 1
64 esac