

- #Mac sleepwatcher for mac os x#
- #Mac sleepwatcher mac os x#
- #Mac sleepwatcher install#
- #Mac sleepwatcher update#
- #Mac sleepwatcher manual#
Now make your computer sleep, wake it up and see if you get the notification (click on the notification icon if it doesn't show up) and if VPN starts. Launchctl load ~/Library/LaunchAgents/de. via brew:Īnd create a launch agent to start it with the wake script, based on the example provided by brew when installing ( /usr/local/Cellar/sleepwatcher/2.2/de., renamed and modified) - ~/Library/LaunchAgents/de.:
#Mac sleepwatcher install#
We will use sleepwatcher, install it f.ex. # get state of first configuration where name = "MY_VPN"ĭisplay notification "(See ~/wake.sh)" with title "Tunneblick connecting." # Uncomment v to wait until the connection is establieshed: # Start Tunnelblick VPN after wakeup (run via sleepwatcher) (Re)Connect to VPN after wake up from sleepĬreate the AppleScript ~/wake.sh to connect VPN and display a notification about it (OS X 10.9+): It can be used to execute a Unix command when the.
#Mac sleepwatcher mac os x#
Select "When computer starts" for the VPN config option "Connect". SleepWatcher Synchronize Pro X IMAP 120 Minute IPA 10.5: Repair Time Machine after logic board changes (via Mac OS X Hints) SafeNet Solid state drive (SSD) Cha-Ching 2 Squirrel 0.7. SleepWatcher is a command line tool (daemon) for macOS that monitors sleep, wakeup and idleness of a Mac.
#Mac sleepwatcher manual#
The ' Fix for the no DHCP ethernet on wake from sleep problem ' thread defines a set of manual steps you can take to un-install SleepWatcher.

Instead, you have to manually uninstall all of the files distributed throughout Mac OS X. Disconnect manually when at work.įuture: Check the current location (wifi name? IP?) and do not connect when at work. SleepWatcher does not facilitate automated un-install.

Partial solution: Make sure VPN is always running with "connect when computer starts" and using an AppleScript to connect after waking up from sleep.
#Mac sleepwatcher for mac os x#
If your needs are the same as mine, I think you'll find it well worth the few bucks they charge.Need: Make sure that VPN is always running except when at work. Today we spotlight SleepWatcher, a command line tool (daemon) for Mac OS X that monitors sleep, wake-up and idleness of a Mac. This has very quickly become one of a small handful of utilities I can't live without. I've found a small and inexpensive app that does this very well so far: Jettison. In my case I don't need to run arbitrary scripts, but instead just eject external drives.
#Mac sleepwatcher update#
UPDATE I have not found sleepwatcher to be consistently reliable since originally writing this answer, although it initially appeared to be working. I'll keep testing and if I find it to not work sometimes I'll update my answer, and keep testing other options. On the other hand, in my tests (so far) sleepwatcher has appeared to be quite reliable and fast. The low-level performance just doesn't seem to be there, however, for running a script before sleeping. I'm sorry to have to say that it failed, however, because in so many respects it is a really nicely designed and quite powerful and flexible program. I hope to save you and anyone else reading this the hours of testing it took me to come to this conclusion. Enter the following in Terminal and type your root password when prompted: sudo brew install sleepwatcher 3 - Create the launchd plist. Although it is a very impressive program which I would recommend in general, after testing it for this purpose it does NOT actually appear to be able to trigger scripts quickly enough for them to run before your Mac goes to sleep, and instead the sleep script will not run until after the Mac has woken up, which (obviously) defeats the purpose. If you use 'fast user switching' to sleep you will find that scripts which require a logged in user will attempt to run too early and fail unless you modify the Launch Daemon - perhaps grep 'Succeeded' in 'secure.log'.Īnother program which you might discover and be tempted to try is EventScripts.

The file is cleared by a log 'Sleep' entry and by Shut Down. The Launch Daemon watches and writes to a temporary file provided the file is empty. My Launch Daemon resides at /Library/LaunchDaemons/ist You may need to increase 'ExitTimeOut' for some scripts. I write a date to z but you could change this to write anything. Tail -1 /Library/Logs/DirectoryService/ | grep -v Sleep || > $z I developed the following simple Launch Daemon to provide a 'wake' trigger for scripts on Leopard:
