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?