0

I have an VPN that I'd like to be on all time. The VPN is an OpenVPN type and was set up and used via the VPN software Tunnelblick. For some unknown reason, the VPN connection or the Tunnelblick process tend to run into a bad state after the VPN has been on for long time, say a day. I'd like to set up a cron job, so it is restarted every night. How to do this?

OS: macOS Sierra 10.12

qazwsx
  • 8,599
  • 24
  • 58
  • 86

1 Answers1

0

Write an AppleScript oneliner per the official TunnelBlick documentation:

osascript -e "tell application \"Tunnelblick\"" -e "connect \"configuration-name\"" -e "end tell"

And set it as a cron job.

techraf
  • 4,852
  • 11
  • 24
  • 40
  • Running `osascript -e "tell application Tunnelblick" -e "disconnect \"my-vpn\"" -e "end tell"` from my bash command line gave me error: 40:41: syntax error: Expected end of line but found “"”. (-2741) in macOS Sierra + iTerm2. – qazwsx Sep 29 '16 at 20:19
  • Add quotes around `TunnelBlick`. – techraf Sep 29 '16 at 21:41