PKGBUILDs/extra/deluge/deluged
2009-10-09 21:23:22 -05:00

42 lines
722 B
Bash

#!/bin/bash
. /etc/rc.conf
. /etc/rc.d/functions
[[ -f /var/run/deluged.pid ]] && PID=`cat /var/run/deluged.pid`
case "$1" in
start)
stat_busy "Starting Deluge Daemon"
[[ -z $PID ]] && /usr/bin/deluged 2>&1
if [ $? -gt 0 ]; then
stat_fail
else
echo $(pgrep deluged) > /var/run/deluged.pid
add_daemon deluged
stat_done
fi
;;
stop)
stat_busy "Stopping Deluge Daemon"
[[ ! -z $PID ]] && kill $PID &> /dev/null
if [ $? -gt 0 ]; then
stat_fail
else
rm /var/run/deluged.pid
rm_daemon deluged
stat_done
fi
;;
restart)
$0 stop
sleep 1
$0 start
;;
*)
echo "usage: $0 {start|stop|restart}"
esac
exit 0