Make Viscosity connect automatically, when a Time Machine backup starts?

Got a problem with Viscosity or need help? Ask here!

DominikHoffmann

Posts: 11
Joined: Wed May 30, 2018 3:49 pm

Post by DominikHoffmann » Mon May 20, 2024 11:19 pm
Is there a way for Viscosity to automatically establish a connection, when my Mac starts a Time Machine backup? I have a sufficiently fast inbound connection to my home network that it would be feasible to do Time Machine backups, when away from home.

Is there a way for this to trigger the connection to my home network? Perhaps any attempt to connect to a specific IP address?

James

User avatar
Posts: 2342
Joined: Thu Sep 04, 2008 9:27 pm

Post by James » Tue May 21, 2024 4:58 pm
Hi Dominik,

I'm afraid it isn't really possible. While it would be theoretically possible to use pf (macOS's firewall) to trigger an action based on a packet match, that wouldn't solve the problem, as the connection to the Time Machine file share would have already failed. It would be necessary to man-in-the-middle and intercept the connection and keep it alive until the VPN connection is active.

You're likely better off having a script that runs periodically (you can set it as a hourly or daily cron job for example) that does the following:
1. Checks if you're on your home network, and if so exits
2. Connects the VPN connection
3. Triggers a Time Machine backup
4. Optionally disconnect the VPN connection

Instructions for connecting a Viscosity VPN connection can be found at:
https://www.sparklabs.com/support/kb/ar ... cript-mac/

You can call the command "tmutil startbackup -b" in your script to trigger a Time Machine backup:
https://www.unix.com/man-page/osx/8/TMUTIL/

Cheers,
James
Web: https://www.sparklabs.com
Support: https://www.sparklabs.com/support
Twitter: https://twitter.com/sparklabs
2 posts Page 1 of 1