That does it.
The new script:
Code: Select all
#!/bin/sh
# created by mambang
# Headless deluge startup script
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DELUGE="/usr/bin/deluge"
DELUGE_OPTIONS="-u web"
USER="Your User" #Please change
DELUGEDAEMON="/usr/bin/deluged"
DESC1="Deluge Daemon"
DESC2="WebUi"
NAME1="deluged"
NAME2="Deluge webserver"
set -e
case "$1" in
start)
echo -n "Starting $DESC1 : "
start-stop-daemon -c $USER --start --background --quiet --exec $DELUGEDAEMON
echo "$NAME1"
sleep 2
echo -n "Starting $DESC2 : "
start-stop-daemon -c $USER --start --background --quiet --exec $DELUGE -- ${DELUGE_OPTIONS}
echo "$NAME2"
;;
stop)
echo -n "Stopping $DESC1 : "
PIDDELUGE=`ps ax |grep deluged |sed -n 1p |awk '{print $1}'`
kill $PIDDELUGE
echo "$NAME1."
echo -n "Stopping $DESC2 : "
PIDWEB=`ps ax |grep deluge |sed -n 2p |awk '{print $1}'`
kill $PIDWEB
echo "$NAME2."
;;
*)
N=deluge-daemon
echo "Usage: $N {start|stop|restart}" >&2
exit 1
;;
esac
exit 0