Code sources - deluge.script source code
From WikiDLXTV
#!/bin/sh DELUGECONFIG="$2" case "$1" in start) online.delayer 60 # pause until online add.webplugin deluge /etc/deluge/deluge deluged -c $DELUGECONFIG if [ "`grep -i \^DELUGEWEBUI=\'OFF\' /conf/config`" == "" ] ; then [ -w /var/www -a ! -d /var/www/deluge ] && ln -s $DELUGECONFIG /var/www/deluge sleep 3 && deluge -c $DELUGECONFIG -u web & fi ;; stop) [ "`pidof deluged`" != "" ] && killall deluged && sleep 5 [ "`pidof deluge`" != "" ] && killall deluge && sleep 5 ;; *) echo "Usage: $0 (start|stop)" ;; esac