Page 1 of 1

Deluge and VPN

Posted: Sat Nov 03, 2018 1:39 pm
by vapulabis
Hello

I have looked for a while now and unless I am blind to seeing it, I cannot find a plugin to do what I would like it to do unless someone can point me at it, my internet at the moment is dodgy dropping in and out, I use a VPN with Deluge on an old Linux laptop running Linux Mint 17 and it runs 24 hours a day. My problem is that when the internet drops, the VPN disables, but Deluge keeps running, and when the internet comes back on, the VPN does not start automatically so I end up with my Deluge laptop seeding and downloading without a VPN, so what I would like is for Deluge to turn itself off when my internet drops out to save any problems. is this a possibility?

TIA Vapulabis

Re: Deluge and VPN

Posted: Mon Nov 05, 2018 1:01 am
by gderf
Search the forum on the word "killswitch"

Re: Deluge and VPN

Posted: Mon Nov 05, 2018 8:21 pm
by vapulabis
I created my own killswitch, I created a BASH file called killdeluge.sh and created a cron job to run it

Code: Select all

#!/bin/bash
if ! (ping -q -c 1 -W 1 8.8.8.8 >/dev/null); then
pkill deluge
fi


made the file executable (chmod 755)

created a cronjob to run every minute

Code: Select all

1 * * * * sh /Mine/MyFolder/stopdeluge.sh

Re: Deluge and VPN

Posted: Tue Nov 06, 2018 12:30 am
by vapulabis
unfortunately attempt number one didn’t work so I had to rethink it

Code: Select all

#!/bin/bash
if ! (ping -W 1 8.8.8.8 >/dev/null); then
pkill deluge
fi


moved it to /usr/local/bin and chmod+x

then crontab now reads

Code: Select all

* * * * * /usr/local/bin/stopdeluge.sh


and it now works a treat, within 90 seconds of me pulling the internet from the laptop, deluge gets turned off, this is well within the time it takes for my router to be back up running and connected to the internet for it to get a ping, so if we have a power cut or the internet drops out Deluge will not be running when the internet gets back