Sunday 16 June 2013

I command you to nap

I finally found out how to properly ask my Mac to take a nap. First unmount (tech talk for "disconnect") the backup disk that i always have connected into the USB hub. I naïvely assume it will always be identified as /dev/disk1 because because i'm lazy and i haven't given it a label. I suppose that would be the better way. Then, uh, tell Finder to sleep. Whoa.

And after waking up, try to mount the backup disk again.

So save this as ~/bin/nap and make it executable by casting the spell chmod u+x ~/bin/nap from the terminal.


diskutil unmountDisk /dev/disk1
osascript -e 'tell application "Finder" to sleep'

diskutil mountDisk /dev/disk1

Didn't think it would be so simple. I guess i'm just bad at googling :)

[quick highlighter]

No comments:

Post a Comment