Configure external storage for saving and loading deluge settings
From WikiDLXTV
Contents
Problem
There is problem that deluge client only save settings while device is plugged in. On next time then device is plug in you need to set up deluge again.
Solution
- Enable startup of deluge on your device
- Configure settings you want in deluge.
- Stop deluge daemon.
- Copy deluge settings folder from "/tmp/deluge" to your external storage folder, i.e, "-deluge". Store this path in variable DELUGECONFIG (i.e. replace $2 in the script to -deluge).
- Create deluge modified start/stop script "deluge.script", type source code, and place it in DELUGECONFIG folder. Source code:
#!/bin/sh DELUGECONFIG="$2" case "$1" in start) online.delayer 60 # pause until online add.webplugin deluge /etc/deluge/deluge deluged -c $DELUGECONFIG if [ "`grep -i \^DELUGEWEBUI=\'OFF\' /conf/config`" == "" ] ; then [ -w /var/www -a ! -d /var/www/deluge ] && ln -s $DELUGECONFIG /var/www/deluge sleep 3 && deluge -c $DELUGECONFIG -u web & fi ;; stop) [ "`pidof deluged`" != "" ] && killall deluged && sleep 5 [ "`pidof deluge`" != "" ] && killall deluge && sleep 5 ;; *) echo "Usage: $0 (start|stop)" ;; esac
- Create script "S00custom-options", type source code, and place it in root folder of your external storage. Source code:
#!/bin/sh #type external storage id #to see it, type command "mount" in ssh on you device #you will see string like "/tmp/media/usb/USB1/8d29b444-7459-41c2-a12a-c2a97087aef4" #"8d29b444-7459-41c2-a12a-c2a97087aef4" - id DEVID="<external storage id>" #type deluge config folder DELUGECONFIG="<deluge config folder>" case "$1" in start|restart) $0 waitfordevice& ;; waitfordevice) DEVROOT="" while [ "$DEVROOT" = "" ] ; do DEVROOT="`mount | grep $DEVID | sed 's/^[/]dev[/].*[ ]on[ ]//g' | sed 's/[ ]type[ ].*//g'`" sleep 3 done $DEVROOT/$DELUGECONFIG/deluge.script start $DEVROOT/$DELUGECONFIG config_tool -c POWER_DOWN_ACTION10="$DEVROOT/power.down $DELUGECONFIG" ;; esac
You need to set up DEVICEID variable in "S00custom-options" (replace <external storage id> with your external storage id), and DELUGECONFIG variable with value you selected earlier. In this tip it is "-deluge"
- Create script "power.down", type source code, and place it in root folder of your external storage. Source code:
#!/bin/sh DEVROOT=`dirname $0` DELUGECONFIG="$1" $DEVROOT/$DELUGECONFIG/deluge.script stop umount -l $DEVROOT
Content of external storage at end
.. $DELUGECONFIG $DELUGECONFIG/deluge.script power.down S00custom-options <other files and folders>
Usage
Well, there is ways to using torrent on external storage:
Loading with torrent
- Plug off device
- Connect external storage
- Plug on device
- Wait about 1-2 mins, device will load and start deluge
For safe eject of external storage, push OFF button on remote. Script will close deluge and unmount filesystem. It is better to set usb power off option - in this case then script close deluge, usb power will off, and you will see it.
Loading without torrent
- Plug off device
- Plug on device
- Wait for end of loading (you will see OSD main screen)
- Connect external storage