I'm developing an embedded system based on ubuntu 12.04 that runs an OpenVPN client to connect to a central server. However, the system may not always have internet access when it is booted. The problem I now have is that OpenVPN is delaying startup by about a minute because it tries to establish a connection synchronously. This bothers me because the user sometimes has to reboot the system after changing settings on the web interface.
The goal is thus to either make the connection attempt terminate within 5 seconds if no internet connection is available, or better, start OpenVPN asynchronously after the rest of the system has booted. It is important that the daemon keeps running and retrying even if it fails to connect during startup.
Apparently openvpn is started from /etc/rcX.d as well as /etc/network/if-up.d. I have tried removing both and starting it as a cronjob "@startup" instead, but that doesn't seem to work. How can I solve the problem more properly?