#!/bin/sh # created by mambang # script utk memulakan deluged daemon dan deluge ui. PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin DELUGE="/usr/bin/deluge" DELUGE_OPTIONS="-u web" DELUGE_OPTIONS2="-u gtk" DELUGE_OPTIONS3="-u null" DELUGEDAEMON="/usr/bin/deluged" DESC1="Deluge Daemon" DESC2="WebUi" DESC3="Gtk" DESC4="Null" NAME1="deluged" NAME2="Deluge webserver" NAME3="Deluge UI" set -e case "$1" in deluged) echo -n "Starting $DESC1 : " start-stop-daemon --start --background --quiet --exec $DELUGEDAEMON echo "$NAME1" ;; web) echo -n "Starting $DESC1 : " start-stop-daemon --start --background --quiet --exec $DELUGEDAEMON echo "$NAME1" sleep 2 echo -n "Starting $DESC2 : " start-stop-daemon --start --background --quiet --exec $DELUGE -- ${DELUGE_OPTIONS} echo "$NAME2" ;; gtk) echo -n "Starting $DESC1 : " start-stop-daemon --start --background --quiet --exec $DELUGEDAEMON echo "$NAME1" sleep 2 echo -n "Starting $DESC3 : " start-stop-daemon --start --quiet --exec $DELUGE -- ${DELUGE_OPTIONS2} echo "$NAME3" ;; null) echo -n "Starting $DESC1 : " start-stop-daemon --start --background --quiet --exec $DELUGEDAEMON echo "$NAME1" sleep 2 echo -n "Starting $DESC4 : " start-stop-daemon --start --quiet --exec $DELUGE -- ${DELUGE_OPTIONS3} echo "$NAME4" ;; stop-all) echo -n "Stopping $DESC1 : " #killall -9 $NAME1 PIDDELUGE=`ps ax |grep deluged |sed -n 1p |awk '{print $1}'` kill $PIDDELUGE echo "$NAME1." echo -n "Stopping $NAME3 : " PIDWEB=`ps ax |grep deluge |sed -n 2p |awk '{print $1}'` kill $PIDWEB echo "Ok." ;; stop-ui) echo -n "Stopping $NAME3 : " PIDWEB=`ps ax |grep deluge |sed -n 2p |awk '{print $1}'` kill $PIDWEB echo "Ok." ;; *) N=deluge-daemon echo "Usage: $N