All pastes #931678 Raw Edit

Untitled

public text v1 · immutable
·published 2008-03-07 09:31 UTC
rendered paste body
#!/bin/sh
# created by mambang
# script utk memulakan deluged daemon dan deluge webui (deluge webserver)

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
WEBDAEMON="/usr/share/python-support/deluge-torrent/deluge/ui/webui/webui_plugin/run_webserver06"

DELUGEDAEMON="/usr/bin/deluged -p 58846"
DESC1="Deluge Daemon"
DESC2="WebUi"
NAME1="deluged"
NAME2="Deluge webserver"

set -e


case "$1" in
  start)
        echo -n "Starting $DESC1 : "
        start-stop-daemon --start --background --quiet --exec $DELUGEDAEMON
        echo "$NAME1"
        sleep 7
        echo -n "Starting $DESC2 : "
        start-stop-daemon --start --background --quiet --exec $WEBDAEMON
        echo "$NAME2"
        ;;
  stop)
        echo -n "Stopping $DESC1 : "
        killall -9 $NAME1
        echo "$NAME1."
        echo -n "Stopping $DESC2 : "
        PIDWEB=`ps ax |grep run_webserver06 |sed -n 1p |awk '{print $1}'`
        kill $PIDWEB
        echo "$NAME2."
        ;;

  restart|force-reload)
        echo -n "Restarting $DESC1 : "
        killall -9 $NAME1
        sleep 2
        start-stop-daemon --start --background --quiet --exec $DELUGEDAEMON
        echo "$NAME1."
        echo -n "Restarting $DESC2 : "
        PIDWEB=`ps ax |grep run_webserver06 |sed -n 1p |awk '{print $1}'`
        kill $PIDWEB
        sleep 2
        start-stop-daemon --start --background --quiet --exec $WEBDAEMON
        echo "$NAME2."
        ;;
  *)
        N=deluge-daemon
        echo "Usage: $N {start|stop|restart|force-reload}" >&2

        exit 1
        ;;
esac

exit 0
(END)