mirror of
https://github.com/archlinuxarm/PKGBUILDs.git
synced 2024-11-08 22:45:43 +00:00
43 lines
875 B
Bash
43 lines
875 B
Bash
#!/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
|