Put your mac to rest via ssh
Sometimes my Macbook decides to wake up from his sleep (a.k.a hibernation). Most of the times i notice this at work when my emails disappear from my imap inbox as Mail.app applies his rules.
As i do not have Apple Remote Desktop or any other VNC server enabled on my Macbook, i do have a problem.
I can vpn into my home and i can ssh into the Macbook, so i came up with the following solution:
Put the following three lines into a plain textfile, i.e. “sleep.txt” and save it somewhere:
tell application "Finder" sleep end tell
Then, open Terminal.app, change to the directory you saved the file in and execute:
osascript sleep.txt |
Your ssh connection will then timeout and the Mac sleeps.
Stupid me forgot that ssh can execute remote commands: From your workmachine execute
ssh my_home_computer 'osascript sleep.txt' |
and you’re done. Thanks “tante” for reminding me 🙂
Alternatively, you can achieve similar with Mail.app itself, have a look at the solution here, but i like mine better.