All pastes #972027 Raw Edit

Miscellany

public text v1 · immutable
·published 2008-04-05 03:33 UTC
rendered paste body
#!/bin/sh
# created by mambang
# script utk memulakan deluged daemon waktu boot.

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DELUGE="/usr/bin/deluge"
USER="oshiri" #please add user that will run deluge

DELUGEDAEMON="/usr/bin/deluged"
DESC1="Deluge Daemon"
NAME1="deluged"

set -e


case "$1" in
  start)
        echo -n "Starting $DESC1 : "
        start-stop-daemon -c $USER --start --background --quiet --exec $DELUGEDAEMON
        echo "$NAME1"
        ;;
  stop)
        echo -n "Stopping $DESC1 : "
        #killall -9 $NAME1
        PIDDELUGE=`ps ax |grep deluged |sed -n 1p |awk '{print $1}'`
        kill $PIDDELUGE
        echo "$NAME1."
        ;;

  restart)
        echo -n "Restarting $DESC1 : "
        PIDDELUGE=`ps ax |grep deluge |sed -n 1p |awk '{print $1}'`
        kill $PIDDELUGE
        sleep 5
        start-stop-daemon --start --background --quiet --exec $DELUGEDAEMON
        echo "$NAME1."
        ;;
  *)
        N=deluged
        echo "Usage: $N {start|stop|restart}" >&2

        exit 1
        ;;
esac

exit 0