Advertisement
the-technoholik

OpenVPN disconnect and restore DNS config

Feb 13th, 2015
364
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.24 KB | None | 0 0
  1. #!/bin/sh -e
  2.  
  3. script_dir="`dirname $0`"
  4. vpnpidfile="openvpn.pid"
  5.  
  6. if ! cd $script_dir ; then
  7.     echo "Cannot cd to $script_dir." 1>&2
  8.     exit 1
  9. fi
  10.  
  11. vpnpid=`cat $vpnpidfile`
  12.  
  13. sudo kill -INT $vpnpid
  14.  
  15. # Restore DNS
  16. sudo resolvconf -u
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement