updated on Thu Jan 26 16:09:46 UTC 2012
[aur-mirror.git] / sickbeard-git / sickbeard.init
blob3587bbc206ecb917435705ddc3481e2ae3c4b95b
1 #!/bin/bash
3 . /etc/rc.conf
4 . /etc/rc.d/functions
5 . /etc/conf.d/sickbeard
7 case "$1" in
8 start)
9 stat_busy "Starting Sick-Beard"
11 if [ -f /var/run/daemons/sickbeard ]; then
12 echo -n "Sickbeard is already running as a daemon! If you are certain it is not running, remove /var/run/daemons/sickbeard."
13 stat_fail
14 else
15 su - $SB_USER -c "$SB_PYTHON $SB_BIN -q -d --data $SB_DATA --config $SB_CONF --port $SB_PORT" -s /bin/sh
16 if [ $? -gt 0 ]; then
17 stat_fail
18 else
19 add_daemon sickbeard
20 stat_done
24 stop)
25 stat_busy "Stopping Sick-Beard"
28 wget -q --delete-after $SB_PROTOCOL://127.0.0.1:$SB_PORT/home/shutdown/ &> /dev/null
29 if [ "${?}" -gt 0 ]; then
30 stat_fail
31 else
32 rm_daemon sickbeard
33 stat_done
36 restart)
37 "${0}" stop
38 sleep 1
39 "${0}" start
42 echo "usage: ${0} {start|stop|restart}"
43 esac
44 exit 0