#!/bin/bash . /etc/rc.conf . /etc/rc.d/functions . /etc/conf.d/sickbeard case "$1" in start) stat_busy "Starting Sick-Beard" if [ -f /var/run/daemons/sickbeard ]; then echo -n "Sickbeard is already running as a daemon! If you are certain it is not running, remove /var/run/daemons/sickbeard." stat_fail else su - $SB_USER -c "$SB_PYTHON $SB_BIN -q -d --data $SB_DATA --config $SB_CONF --port $SB_PORT" -s /bin/sh if [ $? -gt 0 ]; then stat_fail else add_daemon sickbeard stat_done fi fi ;; stop) stat_busy "Stopping Sick-Beard" wget -q --delete-after $SB_PROTOCOL://${SB_USPW}localhost:$SB_PORT$SB_WEBROOT/home/shutdown/ &> /dev/null if [ "${?}" -gt 0 ]; then stat_fail else rm_daemon sickbeard stat_done fi ;; restart) "${0}" stop sleep 1 "${0}" start ;; *) echo "usage: ${0} {start|stop|restart}" esac exit 0