The use case is that I need a particular VPN connected at all times on one of my servers which runs macOS. It's set up with Tunnelblick. And I know how to re-connect to it manually using Tunnelblick GUI. But I noticed that sometimes due to network sometimes disconnecting due to instability or some such, Tunnelblick could get into a state of repeatedly trying to reconnect to the previously connected VPN but would never succeed. Therefore, I'm hoping I can create a cron job to periodically check if the VPN is connected (probably by pinging an URL only accessible via the said VPN), and if not, reconnect to it by restarting Tunnelblick and reconnect to the VPN. What should the command line be? I intend to add the command line into my crontab.
You should have a look at this Answer (comments are interesting too): How to start Tunnelblick VPN connection via Terminal
This will guide you to create an AppleScript and then you may launch it by command line or crontab.