updated on Thu Jan 12 16:09:17 UTC 2012
[aur-mirror.git] / deluge-git / deluge-web
blob587496f6dbd96f35fcf286825c9251135b49f33d
1 #!/bin/bash
3 . /etc/rc.conf
4 . /etc/rc.d/functions
5 . /etc/conf.d/deluged
7 [[ -f /var/run/deluge-web.pid ]] && PID=$(cat /var/run/deluge-web.pid)
8 [[ -d /proc/$PID ]] || PID=
10 case "$1" in
11 start)
12 stat_busy "Starting Deluge WebUI"
13 [[ -z $PID ]] && su -l -s /bin/sh -c "/usr/bin/deluge-web -f >/dev/null" $DELUGE_USER
14 if [ $? -gt 0 ]; then
15 stat_fail
16 else
17 sleep 1
18 echo $(pgrep -u $DELUGE_USER deluge-web) > /var/run/deluge-web.pid
19 add_daemon deluge-web
20 stat_done
23 stop)
24 stat_busy "Stopping Deluge WebUI"
25 [[ ! -z $PID ]] && kill $PID &> /dev/null
26 if [ $? -gt 0 ]; then
27 stat_fail
28 else
29 rm /var/run/deluge-web.pid
30 rm_daemon deluge-web
31 stat_done
34 restart)
35 $0 stop
36 sleep 1
37 $0 start
40 echo "usage: $0 {start|stop|restart}"
41 esac
42 exit 0