Choose language

Portal Home > Knowledgebase > How-to > Hosting > Deluge > Deluge mulitiple instances


Deluge mulitiple instances




Please log in to your service SSH, here is an article how to do this:

https://www.seedhost.eu/whmcs/knowledgebase.php?action=displayarticle&catid=36&id=54

Installation


1. Create new directories required by the new deluge1 instance:

mkdir -p ~/downloads/deluge1/watch/deluge


2. Copy deluge configuration to deluge1:

cp -rf ~/.config/deluge ~/.config/deluge1


3. Remove main user files from the deluge1 directory:


find ~/.config/deluge1/state/ -name *torrent* -print0 | xargs -0 rm -f

 

rm -f ~/.config/deluge1/{deluged.pid,dht.state,deluged.log}


4. Edit deluge1 configuration to reflect the deluge1 instance:


sed -i "s:$(whoami)/downloads:$(whoami)/downloads/deluge1:" ~/.config/deluge1/core.conf

 

sed -i "s:$HOME\":$HOME/downloads/deluge1\":" ~/.config/deluge1/core.conf

 

sed -i "s:config/deluge:config/deluge1:" ~/.config/deluge1/core.conf

 

sed -i "s:daemon_port.*:daemon_port\"\: $(shuf -i 23700-23900 -n 1),:" ~/.config/deluge1/core.conf

 

sed -i "s:port.*:port\"\: $(shuf -i 23900-23999 -n 1),:" ~/.config/deluge1/web.conf

 

sed -i "s:/$(whoami)/deluge::" ~/.config/deluge1/web.conf

 

sed -i "9s:[0-9].*:$(grep daemon ~/.config/deluge1/core.conf | awk -F " " '{print $2}' | cut -d "," -f1),:" ~/.config/deluge1/hostlist.conf.1.2



5. Change deluge1 webui and the deamon password, where deluge1pass is a password for the deluge1 instance:

PASS=deluge1pass;sed -i "s:sha1.*:sha1\"\: \"$(echo -n "$(grep salt ~/.config/deluge1/web.conf | awk -F "\"" '{print $4}')$PASS" | openssl dgst -sha1 |awk '{print $2}')\",:" ~/.config/deluge1/web.conf


6. Start the deluged and deluge-web for the deluge1 instance:

deluged -c ~/.config/deluge1/ && deluge-web -c ~/.config/deluge1/ -f


7. Create a cronjob to start the deluged and deluge-web for the deluge1 instance if it's down every 5 minutes:

(crontab -l;echo -e "*/5\t*\t*\t*\t*\t/usr/bin/pgrep -f deluge1 || rm -f ~/.config/deluge1/deluged.pid && deluged -c ~/.config/deluge1/ && deluge-web -c ~/.config/deluge1/ -f") | crontab -u $(whoami) -


That's all, deluge1 instance is running, to verify:

pgrep -f deluge1 > /dev/null && echo "Deluge started" || echo "Deluge not started"


Now get your deluge1 instance URL:

echo -e "Deluge URL: http://$(hostname):$(grep port ~/.config/deluge1/web.conf | awk -F " " '{print $2}'|cut -d "," -f1)"



If you want to use more instances just change deluge1 in all steps to deluge2,deluge3 etc. If you want to have a different username, for example the username mybox to another instance just replace deluge1 to mybox in all steps.

Manually restarting deluge1 instance

1. Stop the deluged and deluge-web:

kill -9 $(pgrep -f deluge1)


2. Start the deluged and deluged-web:

deluged -c ~/.config/deluge1/ && deluge-web -c ~/.config/deluge1/ -f



Uninstallation

1. Remove the cronjob for the deluge1 instance:

crontab -l | sed -e "/deluge1/d" | crontab -u $(whoami) -


2. Stop the deluged and deluge-web:

kill -9 $(pgrep -f deluge1)


3. Remove all deluge1 files:

rm -rf ~/.config/deluge1

 

rm -rf ~/downloads/deluge1

 



Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read
Deluge - troubleshooting (Views: 14271)
Deluge thin configuration (Views: 24743)

Powered by WHMCompleteSolution