diff options
author | Adrian C. (anrxc) <anrxc@sysphere.org> | 2012-11-25 21:24:58 +0100 |
---|---|---|
committer | Adrian C. (anrxc) <anrxc@sysphere.org> | 2012-11-25 21:24:58 +0100 |
commit | 16262790cb6ddacf6c632625cc865e03b1b8671f (patch) | |
tree | 09898d65deef518380915ecdc7575756c9ca8595 /src/deluge | |
parent | 7bb1499a7cd539f714bb7f603d7fc0a38fd8a963 (diff) | |
download | rcdscripts-16262790cb6ddacf6c632625cc865e03b1b8671f.tar.xz |
rcdscripts: import first snapshot of rc.d scripts as of 11.25.20122012.11.25
In 30 days these scripts will start dissapearing from official Arch
Linux packages. This is an attempt to conserve them, and keep sysvinit
usable.
Diffstat (limited to 'src/deluge')
-rwxr-xr-x | src/deluge/deluge-web | 45 | ||||
-rwxr-xr-x | src/deluge/deluged | 43 |
2 files changed, 88 insertions, 0 deletions
diff --git a/src/deluge/deluge-web b/src/deluge/deluge-web new file mode 100755 index 0000000..d612c41 --- /dev/null +++ b/src/deluge/deluge-web @@ -0,0 +1,45 @@ +#!/bin/bash + +. /etc/rc.conf +. /etc/rc.d/functions +. /etc/conf.d/deluged + +PIDFILE=/run/deluge/deluge-web.pid +WEB_OPTIONS="-f $WEB_OPTIONS" + +[[ -f $PIDFILE ]] && PID=$(<$PIDFILE) +[[ -z $PID ]] || kill -0 $PID || PID= + +case "$1" in + start) + stat_busy "Starting Deluge WebUI" + [[ -z $PID ]] && su -l -s /bin/sh -c "/usr/bin/deluge-web $WEB_OPTIONS >/dev/null" deluge + if [ $? -gt 0 ]; then + stat_fail + else + sleep 1 + echo $(pgrep -u deluge deluge-web) > $PIDFILE + add_daemon deluge-web + stat_done + fi + ;; + stop) + stat_busy "Stopping Deluge WebUI" + [[ ! -z $PID ]] && kill $PID &> /dev/null + if [ $? -gt 0 ]; then + stat_fail + else + rm $PIDFILE + rm_daemon deluge-web + stat_done + fi + ;; + restart) + $0 stop + sleep 1 + $0 start + ;; + *) + echo "usage: $0 {start|stop|restart}" +esac +exit 0 diff --git a/src/deluge/deluged b/src/deluge/deluged new file mode 100755 index 0000000..dd426fc --- /dev/null +++ b/src/deluge/deluged @@ -0,0 +1,43 @@ +#!/bin/bash + +. /etc/rc.conf +. /etc/rc.d/functions +. /etc/conf.d/deluged + +PIDFILE=/run/deluge/deluged.pid +OPTIONS="-P $PIDFILE $OPTIONS" + +[[ -f $PIDFILE ]] && PID=$(<$PIDFILE) +[[ -z $PID ]] || kill -0 $PID &>/dev/null || PID= + +case "$1" in + start) + stat_busy "Starting Deluge Daemon" + [[ -z $PID ]] && su -l -s /bin/sh -c "/usr/bin/deluged $OPTIONS >/dev/null" deluge + if [ $? -gt 0 ]; then + stat_fail + else + 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 -f $PIDFILE + rm_daemon deluged + stat_done + fi + ;; + restart) + $0 stop + sleep 1 + $0 start + ;; + *) + echo "usage: $0 {start|stop|restart}" +esac +exit 0 |