(Torren & VPN) && || ipleak ,protect yourself


This is simple script for protect yourself when you vpn connection fails.

Idea for script is simple kill torrent client when vpn not work .
Script every 2 seconds checking status vpn connection in NetworkManger if vpn work  nothing do, but when vpn is down script check memory if find there process deluge or transmission kill . You can add more application example “deluge\|transmission\|other_client ‘

https://github.com/dzaczek/blogscripts/blob/master/torentmonitor.sh

 

notify-send -u normal -t 3000 "Monitoring script started $$";
while true; do  nmcli con |if [[  $(perl -ne 'print "1\n" if /(^\S+)\s+(\S+)\s+vpn\s+(\S+)\s+/ &&  $3 ne "--" ') -eq 1 ]];
then echo  "ok minitor work vpn work torrent work > /tmp/appstatus.log";
else kill -9 $(ps aux | grep 'deluge\|transmission' | grep -v grep |  cut -d" " -f3)  > /dev/null 2>&1 &&  notify-send -u normal -t 1000000 "VPN Dont working killing torrent"  || echo  "Torrent and vpn dont work" > /tmp/appstatus.log ;
fi; sleep 2; done

Sorry for low level of this script but was wrote in a hurry.

Leave a comment