Author Topic: How to have deluge save/resume torrents after reboot  (Read 3184 times)

January 10, 2010, 11:35:44 AM
Read 3184 times

acidnite

  • Newbie

  • Offline
  • *

  • 3
I have been playing around with deluge to find a way to save the state of the torrents after a reboot. I am thinking it should be possible to have deluge run from /etc/deluge/ rather than making an empty copy to /tmp/ every time the device reboots. So far I have:

- loaded the ext3 on my USB which is working (for samba during standby)
- modified the /etc/init.d/S96deluge script (to run deluge from /etc/deluge)
- copy the deluge config files from /conf/ to /etc/deluge/ (with rename)

It seems that the S96deluge script is not running after a reboot and the original config (running from /tmp/deluge) is still running.

Am I missing something here? Is there another place that this script is being run from?

Thanks for the help
« Last Edit: January 13, 2010, 11:22:29 PM by acidnite »

January 10, 2010, 11:47:56 AM
Reply #1

acidnite

  • Newbie

  • Offline
  • *

  • 3
Ok, bad way to follow up a first post, but I figured out my mistake. I have renamed the old S96deluge to S96deluge.old, so it was still running during boot. But for others, here is the /etc/init.d/S96deluge that I am using

#!/bin/sh

case "$1" in
start|restart)
   if [ "`grep -i \^DELUGE=\'ON\' /conf/config`" != "" ] ; then
        [ "`pidof deluged`" != "" ] && killall deluged && sleep 2
        [ "`pidof deluge`" != "" ] && killall deluge && sleep 2

        while (true); do
          DNS=$(grep '^nameserver[[:space:]]*[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*$' /etc/resolv.conf | cut -d' ' -f2 | head -n 1)
          if [ -n "$DNS" ]; then
            ping -q -c 1 $DNS 1>/dev/null 2>/dev/null && break
          fi
          sleep 30
        done

        add.webplugin deluge /etc/deluge/deluge
        deluged -c /etc/deluge
        if [ "`grep -i \^DELUGEWEBUI=\'OFF\' /conf/config`" == "" ] ; then
                [ -e /var/www -a ! -d /var/www/deluge ] && ln -s /etc/deluge/deluge /var/www/deluge
                sleep 3 && deluge -c /etc/deluge -u web &
        fi
   else
        remove.webplugin deluge
   fi
   ;;
forcestart)
   config_tool -c DELUGE=ON
   sleep 3
   /etc/init.d/S96deluge start
   ;;
stop)
   [ "`pidof deluged`" != "" ] && killall deluged && sleep 5
   [ "`pidof deluge`" != "" ] && killall deluge && sleep 5
   ;;
*)
   echo "Usage: $0 (start|stop|restart|forcestart)"
   ;;
esac

This will save all the state info in /etc/deluge/state/ and allow torrents to be restored after a reboot.

February 12, 2010, 01:31:34 AM
Reply #2

cleancode

  • Newbie

  • Offline
  • *

  • 1
/etc/init.d/S96deluge is read only.. I cannot edit it !
can you give more detailed instructions?

help!