Restart of vpnc when not requested to stop.

Bug #249802 reported by Tim Jones
4
Affects Status Importance Assigned to Milestone
vpnc (Ubuntu)
New
Undecided
Unassigned

Bug Description

Binary package hint: vpnc

Although an incredibly useful app vpnc isn't (yet) perfect and is known to just drop it's connection and die at times. This is a known problem, with no known solution, yet. But in the meantime...

How about an option to auto-restart vpnc when it dies?

The conditions, as far as I can tell, for a restart to happen would simply be: If vpnc exits with exit code 0 and has not been requested to stop, then restart it.

Currently I need to use a script running in the background to do this for me as vpnc dies many times during a working day. Setting local port to 0 and disabling DPD are also needed here too (see bug #206000 bug #112406 bug #239570).

Revision history for this message
Christoph Langner (chrissss) wrote :

Yep, i noticed too that vpnc looses quite often it's connection. What I've got in my mind is some kind of process monitor. Like

$ foo vpnc start --respawn
$ foo vpnc stop

When i start vpnc with `foo vpnc start --respawn` it get's restarted until i quit it with `foo vpnc stop`. There are some process monitors like restartd etc. out there, but they need to be configured via configuration files. Afaik there is no simple process monitor like the one i've got in my mind.

Revision history for this message
Christoph Langner (chrissss) wrote :

I solved this now by using upstart. Create a /etc/event.d/vpnc with the following content

---
console output
exec /usr/sbin/vpnc --no-detach
respawn
---

Now, you can use

$ sudo start vpnc

to start vpnc or

$ sudo stop vpnc

to stop it. In the case vpnc died when started via `sudo start vpnc` it will be respawned.

Revision history for this message
Tim Jones (tim-mr-dog) wrote :

Excellent idea, works perfectly :)

Although I'd add the '--local-port 0' option to ensure the respawned vpnc doesn't fail due to port already in use problems. I'm using the exec line:

exec /usr/sbin/vpnc --no-detach --pid-file /var/run/vpnc/pid --ifmode tun --non-inter --local-port 0 --dpd-idle 0 <vpn>

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.