PKGBUILDs/aur/couchpotato-git/couchpotato.init

44 lines
875 B
Text
Raw Normal View History

2011-02-28 03:00:10 +00:00
#!/bin/bash
. /etc/rc.conf
. /etc/rc.d/functions
case "$1" in
start)
stat_busy "Starting CouchPotato"
if [ -f /var/run/daemons/couchpotato ]; then
echo -n "CouchPotato is already running as a daemon! If you are certain it is not running, remove /var/run/daemons/couchpotato."
stat_fail
else
su - couchpotato -c "python2 /opt/couchpotato/CouchPotato.py &> /dev/null &" -s /bin/sh
if [ $? -gt 0 ]; then
stat_fail
else
add_daemon couchpotato
stat_done
fi
fi
;;
stop)
stat_busy "Stopping CouchPotato"
curl -f http://localhost:5000/config/exit/ &> /dev/null
if [ $? -gt 0 ]; then
stat_fail
else
rm_daemon couchpotato
stat_done
fi
;;
restart)
$0 stop
sleep 1
$0 start
;;
*)
echo "usage: $0 {start|stop|restart}"
esac
exit 0