Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Run script on startup help
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

Run script on startup help

BellaBella Member
edited August 2014 in Help

Hi I am runnig Lubuntu
http://lubuntu.net/
Basically

Right now I have to type

openvpn --config /home/user/Desktop/server.ovpn

to connect to OpenVPN.

I want to make it automatic on startup and if the connection drops I want it to keep trying to reconnect.

Does anyone here know how to make a bash script to do all that.

Comments

  • To start on startup add to /etc/rc.local

    To make it reconnect, you need to have a wrapper to detect either the loss of connection or if the software remains in the foreground during operation and exits upon failure then something like supervisord will work great.

  • netomxnetomx Moderator, Veteran

    @MarkTurner said:
    To start on startup add to /etc/rc.local

    To make it reconnect, you need to have a wrapper to detect either the loss of connection or if the software remains in the foreground during operation and exits upon failure then something like supervisord will work great.

    Just don't forget to add the & at the end!

    And for the reconnect, just add it to the OpenVPN config

  • SilvengaSilvenga Member
    edited August 2014

    Why not use the default start up script (put the script into your /etc/openvpn/ directory, and change the extension to .conf)?

    If else you can add this to your crontab: crontab -e. With the line: @reboot /usr/sbin/openvpn --config /home/user/Desktop/server.ovpn. This is preferred to using /etc/rc.local now.

    The auto restarting would require using the default script (already exists), an Upstart script (a few lines of config), or by adding the option to your OpenVPN config (preferred).

Sign In or Register to comment.