Babar Haq

Tuesday, April 26, 2011

vpnc auto-connect

For some reason my vpn client (vpnc) in ubuntu keeps getting disconnected. The worst is that I had to connect a couple of times before it would connect. So I wrote this tiny bash script to let it dial until it connects :)

#!/bin/bash
while true ;do
sleep 5
pid=/var/run/vpnc/pid
PID="$(cat "$pid" 2> /dev/null)"
if [ -z "$PID" ]; then
/usr/sbin/vpnc-connect /etc/vpnc/netapp.conf
else
echo connected
break
fi
done

Labels: ,

5 Comments:

Post a Comment

Subscribe to Post Comments [Atom]



<< Home