(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 ‘



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 Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s