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.
6 comments
Just as another hint some people don’t know:
You can give SSH the command it is supposed to run on the remote machine directly. An example:
“ssh my_home_computer hostname” this runs the command “hostname” on the machine “my_home_computer”. Just add a SSH key that only allows your one sleep command and you can put it all into a little icon/shortcut thingy or a local script on your work machine. Saves you some typing ๐
Oh yeah and the SSH connection automatically closes itself after running the command so you don’t have some shell behaving weird due to timeouts ๐
You’re certainly right ๐ Thanks for reminding me…
I was to upset about the stupid macbook waking up. Don’t know what causes it, at least wol doesn’t work over wlan afaik…
Sometimes it comes back on if i switch on the amplifier, maybe its something with power peaks.
But hey, it’s nothing new anymore being upset about Apple products for me.
Well WOL needs a “somewhat-up” network device, I don’t know if Wireless network devices can be in that state. If they can be you should be able to turn it off in the BIOS.
If it is power spikes you could put one of those protection gimmicks between the computer and the power thingamajing which would of course just be a waste of money if it’s something else ๐
I think it’s something else, it “works” even the notebook is on battery… I guess Mac OS X is monitoring in some weird way the line-out port… And yeah, i’m afraid of the question and so i answer it: OS X is still around due to my decision way back to buy into the DRM crapped music. Stupid me, once again. Not that much songs but some albums i couldn’t get elsewhere.
Poor you, I don’t envy you with a problem like that ๐
Post a Comment