Deluge init.d script for Fedora

Deluge

Deluge

The below is a init.d script for fedora based systems to start Deluge in a daemon mode. As I recall I think I got this from the Deluge forum and for all intensive purposes it works well. I didn’t feel much like reinventing the wheel but at least I can post what I am using.

To get this to work properly you will have to edit line 14 and line 23. As far as I can tell with a quick look that is all you will have to do to get things working in a daemon mode.

To follow the rest of this guide I have named the init script “deluge_daemon.sh”.

  1. chmod a+x  deluge_daemon.sh
  2. su -c ‘chown root:root deluge_daemon ‘
  3. su -c ‘cp deluge_daemon.sh /etc/init.d/’
  4. su -c ‘chkconfig deluge_daemon –level 345 on’deluge_daemon –level 345 on’

.


After all that is set you can give it a shot and run su -c ‘service deluge_daemon start’ and everything should have started up and given you the green OK symbols. If it didn’t by chance then you missed a step from above

#!/bin/bash
# chkconfig: 345 85 15
# description: deluged is the Deulge bit torrent daemon. It performs downloads and manages torrents. Connect to the service through the configured port.
# Script to manage start and stopping the fedora service
# processname: deluged

# Source function library.
. /etc/init.d/functions

RETVAL=0;

start() {
echo "Starting deluged service"
daemon --user=deluge deluged -c /home/deluge/.config/deluge/ -p 58846 -l /Torrent/Logs/deluged.log
RETVAL1=$?
echo
[ $RETVAL1 = 0 ] && touch /var/lock/subsys/deluged

echo "Starting deluge webui"
#daemon --user=deluge deluge -u web -c /home/deluge/.config/deluge/ -l /Torrent/Logs/deluged-web.log
#deluge -u web -c /home/deluge/.config/deluge/ -q &
#cant find force background option in daemon function, so I add my own &
runuser -s /bin/bash - deluge -c "ulimit -S -c ${DAEMON_COREFILE_LIMIT:-0} >/dev/null 2>&1 ; deluge -u web -c /home/deluge/.config/deluge/ -l /Torrent/Logs/deluged-web.log &"
[ "$?" -eq 0 ] && success $"$base startup" || failure $"$base startup"

RETVAL2=$?
echo
[ $RETVAL2 = 0 ] && touch /var/lock/subsys/deluge-web

RETVAL=1
if [ $RETVAL1 == 0 ]; then
if [ $RETVAL2 == 0 ]; then
RETVAL=0
fi
fi
return $RETVAL
}

stop() {
echo "Stopping deluge webui"
killproc deluge
RETVAL1=$?
echo
[ $RETVAL1 = 0 ] && rm -f /var/lock/subsys/deluge-web

echo "Stopping deluged service"
killproc deluged
RETVAL2=$?
echo
[ $RETVAL2 = 0 ] && rm -f /var/lock/subsys/deluged
}

restart() {
stop
start
}

case $1 in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
status)
status deluged
status deluge
RETVAL=$?
;;
*)
echo $"Usage: $0 {start|stop|restart|status}"
exit 1
esac

exit $RETVAL

Share and Enjoy:
  • Digg
  • del.icio.us
  • Technorati
  • MySpace
  • Reddit
  • Slashdot
  • StumbleUpon
  • Facebook
  • Google Bookmarks
  • NewsVine
  • RSS
  • Twitter

0 Responses to “Deluge init.d script for Fedora”


  • No Comments
Leave A Comment
  1. (required)
  2. (valid email required)
  3. (required)
  4. Send
 

cforms contact form by delicious:days