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

1
  • What stops you from trying?
    – techraf
    Commented Sep 29, 2016 at 4:37

1 Answer 1

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.

2
  • 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
    Commented Sep 29, 2016 at 20:19
  • Add quotes around TunnelBlick.
    – techraf
    Commented Sep 29, 2016 at 21:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .