Advertisement
Guest User

deluged

a guest
Mar 11th, 2012
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.79 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. . /etc/rc.conf
  4. . /etc/rc.d/functions
  5. . /etc/conf.d/deluged
  6.  
  7. PIDFILE=/run/deluge/deluged.pid
  8. OPTIONS="-P $PIDFILE $OPTIONS"
  9.  
  10. [[ -f $PIDFILE ]] && PID=$(<$PIDFILE)
  11. kill -0 $PID || PID=
  12.  
  13. case "$1" in
  14.   start)
  15.     stat_busy "Starting Deluge Daemon"
  16.     [[ -z $PID ]] && su -l -s /bin/sh -c "/usr/bin/deluged $OPTIONS >/dev/null" $DELUGE_USER
  17.     if [ $? -gt 0 ]; then
  18.       stat_fail
  19.     else
  20.       add_daemon deluged
  21.       stat_done
  22.     fi
  23.     ;;
  24.   stop)
  25.     stat_busy "Stopping Deluge Daemon"
  26.     [[ ! -z $PID ]] && kill $PID &> /dev/null
  27.     if [ $? -gt 0 ]; then
  28.       stat_fail
  29.     else
  30.       rm_daemon deluged
  31.       stat_done
  32.     fi
  33.     ;;
  34.   restart)
  35.     $0 stop
  36.     sleep 1
  37.     $0 start
  38.     ;;
  39.   *)
  40.     echo "usage: $0 {start|stop|restart}"
  41. esac
  42. exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement