[SOLVED]Deluge choose random port when starting

Suggestions and discussion of future versions
Post Reply
Vndtta
New User
New User
Posts: 9
Joined: Fri Jan 04, 2013 11:38 am

[SOLVED]Deluge choose random port when starting

Post by Vndtta »

Hi there, I as some of you have encountered that when you close deluge and try to reopen it again, you can't access the manual selected port, I think this must be fixed in a future version, but meanwhile I made a bashscript to solve it.

Code: Select all

#!/bin/bash

# Script to reset deluge after crashing
PORT="Insert your port here"

# Test if $PORT is free
while true;do
      if [[ -z "$(echo "$(netstat -pa 2> /dev/null | grep $PORT)")" ]];then
            break
      fi  
      echo "Yes, I'm still alive... For science, you monster!"
done

# Once it's free launch deluge
deluge &
Ricanz1
New User
New User
Posts: 5
Joined: Sat Jan 19, 2013 5:06 pm

Re: [SOLVED]Deluge choose random port when starting

Post by Ricanz1 »

Hi Vndtta, How do we apply it to our configuration...where do we insert this script? I'm not a pro at this. Would you be able to accentuate upon the steps required to perform this action? Thank you.
Vndtta
New User
New User
Posts: 9
Joined: Fri Jan 04, 2013 11:38 am

Re: [SOLVED]Deluge choose random port when starting

Post by Vndtta »

You must need administrator privileges for this but just open a text editor (such as vim) paste the above code, save it as redeluge in /usr/bin and then give it executable permissions ( sudo chmod +x redeluge) so instead of launching deluge you type in the terminal redeluge and it's done.

Another option is to replace the deluge launcher so you open a terminal and type:

Code: Select all

#This will give you the directory where deluge is launched from
which deluge

# In my case is /usr/bin so go there and backup the old launcher
cd /usr/bin
sudo cp deluge deluge.bak
sudo rm deluge

# Make a soft link to the script
ln -s /usr/bin/redeluge deluge
Now each time you type deluge in the terminal it will execute the script.

I personally always use the terminal to launch programs, but if you don't and use the Dash or some Docky just create a soft link there to the saved script.

In case something goes wrong just restore the old deluge file
If you need further assistance tell me!
Post Reply