Linux:Vpnc Restart Script

The VPN at my company is very... spotty... at best. When working from home, it used to boot you about once every hour. For whatever reason though, it has recently started booting sessions every five minutes. Now, the solution is of course to speak with our networking folks rather than to write a script to fix the issue on a client by client basis. Unfortunately, due to the culture and various political situations, the networking folks will not fix this because they don't believe it's an issue. All opinionattion aside, this sounds like an opportunity for a nice shell script.

To start things off, on my Linux box I use vpnc from the command line as I don't want to install network manager due to additional resource consumption (albeit a very small amount). That said, throw the following script in  and include   in your PATH variable.

Order of Operations

 * 1) Check if vpnc is already running
 * 2) * Start if it is not running
 * 3) Start an infinite loop
 * 4) Sleep 5 to keep from using too many resources
 * 5) Check cpu time on pid - if it is greater than 1 minute
 * 6) * Kill pid and restart vpnc