Place the following code in /.sleep: osascript -e 'tell application 'Finder' to eject (every disk whose ejectable is true)' Activate sleepwatcher. It also can send the Mac to sleep mode or retrieve the time since last user activity. It can be used to execute a Unix command when the Mac or the display of the Mac goes to sleep mode or wakes up or after a given time without user interaction. I believe you can configure it to look at any script you want, but the local user rc.sleep may have been a requirement for it to all work. Sleepwatcher scripts to eject timemachine before sleep Change Disabled to Disabled. Install command: brew install sleepwatcher Monitors sleep, wakeup, and idleness of a Mac License: GPL-3.0-or-later Formula JSON API: /api/formula/sleepwatcher.json Formula code: sleepwatcher.rb on GitHub Bottle (binary package) installation support provided for: Current versions: stable 2.2. It's quite simple to replicate sleepwatcher's functionality by adding the following to Hammerspoon's /.hammerspoon/a (or create a 'spoon') script that triggers when the machine wakes or sleeps and calls the corresponding wake and sleep scripts (in e.g. SleepWatcher monitors sleep, wakeup and idleness of a Mac. Umount has a -t (type) flag that supposedly allows you to only eject volumes of certain types, such as smb or afp shares, but when I tested it out on an SMB share I had mounted it did absolutely nothing, so I don't know if it works, or maybe its dependent on how the share is read/perceived by the OS.Īs for SleepWatcher, truthfully I haven't set it up or used it in years now and my memory ain't what it once was, so I'm a bit fuzzy on how it worked and how I used it. ![]() This of course would throw an error since it can't unmount the boot volume, but it would proceed to unmount everything else. Kill the running SleepWatcher processes and let launchd restart them:\ \ \f1 sudo killall sleepwatcher\ \f0 \ \ \b Installation for new SleepWatcher users\ \b0 \ When you never have used SleepWatcher before, the following steps are suggests, assuming that you have unpacked the SleepWatcher 2.2 download on your desktop, i. Since switching over from PC to Mac, I’ve always been annoyed that I manually have to eject external disks before putting the computer to sleep. This approach does still work, though, as does the modified script. In the past when I used ARD, I used to issue a 'umount /Volumes/' or 'umount -A' to client systems when I needed to quickly unmount everything on them. 28, 2010 SleepWatcher has been changed since I wrote this post and now differs from the information found in the link below. ls -l /Volumes/ will list them, but its fragile and a little tricky to get the proper volume names from that. The script in the second link isn't going to work, as its using diskutil, which won't list any network mounted shares.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |