1

The operating system I am using is Ubuntu Server 10. I've been trying to cobble together a way to connect to a vpn server via openvpn using command line, run a unison profile, and then disconnect from the vpn connection - all from a bash script. Ultimately, I wanted to run this via cron job every night.

I've figured out that you can run a OpenVPN connection from the terminal by typing in the following:

openvpn --config vpn-config.ovpn --askpass pw.txt

This is done because the server isn't accessible via SSH. Afterwards, I need to synchronize files between my machine and a remote server. I planned on accomplishing this via Unison, a unison profile, and a having my SSH keys already uploaded to the server. So, after connecting to the VPN server, I planned on running this:

unison sync-files.prf

I haven't figured out how to disconnect from a VPN connection automatically. Any ideas?

3
  • serverfault.com/questions/167272/…
    – Nathan C
    Jun 21, 2013 at 23:30
  • I just kill the openvpn process when I want to disconnect.
    – Johnny
    Jun 21, 2013 at 23:31
  • As a side note, when you call Unison on a profile you don't want to include the .prf file extension. The command should just be unison sync-files. Apr 22, 2015 at 16:09

0

Browse other questions tagged .