Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Sleep a Mac with a text or email message Apps
Left your Mac turned on? Send it a message from your phone or email account and send it to sleep. Follow these steps, or just watch the screencast to see them acted out, complete with comments.

First, download Apple's free sleep action for Automator. Create an Automator workflow that has a Pause action, and then a Sleep action. Save it as an application called whatever you like -- sleepnow for instance. You'll now need a one-line AppleScript to call the Automator application. In Script Editor, create this script:
tell application "sleepnow" to run
Change the part inside the quotes to the name of your Automator application. Save the script and remember what you named it.

Finally, open Mail and go to the Preferences. Make sure Mail is set to check for new mail every x number of minutes, then go to Rules. Set the rule criteria so a certain word needs to be in the subject, like sleepnow or somesuch. You can add other criteria if you want, like requiring the mail message to come from a particular address. Then, for the action, pick Run Applescript. Choose the script you created earlier. That's it.

You can add other actions, like playing a sound if you want to be warned that the Mac is going to sleep -- useful if you're sitting in front of it. You can cancel the command during the pause you planted in your Automator application. Obviously this tip can be used to have other actions on your Mac triggered by email. The key is the one line of AppleScript that allows you to call anything that Automator can do.

[robg adds: If you need any more detail on this hint, the above-linked screencast should provide what you need.]
    •    
  • Currently 1.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (1 vote cast)
 
[15,798 views]  

Sleep a Mac with a text or email message | 11 comments | Create New Account
Click here to return to the 'Sleep a Mac with a text or email message' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Sleep a Mac with a text or email message
Authored by: trollll on Jan 02, '07 08:09:34AM

I'll stick with something a little more sane, like SSH-ing to the machine and telling it myself, thanks.



[ Reply to This | # ]
Sleep a Mac with a text or email message
Authored by: jimhoyt on Jan 02, '07 10:04:03AM

You assume a fixed IP address. The nice thing about this hint is that it doesn't require one.

I use a similar method of asking a relatives computer for it's world-visible IP address via a known web email address. The Mac sends the current IP address back and SSH works great from then on.



[ Reply to This | # ]
Sleep a Mac with a text or email message
Authored by: simonpie on Jan 06, '07 05:54:53AM

What is the command to put a mac to sleep via the terminal ?



[ Reply to This | # ]
Sleep a Mac with a text or email message
Authored by: sjk on Jan 06, '07 12:54:35PM

osascript -e 'tell application "Finder" to sleep'



[ Reply to This | # ]
Sleep a Mac with a text or email message
Authored by: billjjones on Jan 02, '07 10:29:47AM

I would use this tip in a heartbeat, for certain things, for certain machines, and lose no sleep over it.

People get a little too paranoid about security sometimes. You think the Russians are watching to see if you shutdown your pc by email? And it's not like you're sending a password in this email message, so show me the security risk.

Agreed, for most things ssh is the way to go. But whenever you implement security features you have to assess the risk in determining the right solution. Otherwise we'd all spend infinite amounts of money on security.



[ Reply to This | # ]
Sleep a Mac with a text or email message
Authored by: q0rban on Jan 02, '07 11:14:26AM

While SSH is certainly more secure, it is also much more powerful, opening your mac to more risk than someone just putting it to sleep.

One thing to make it more secure would be to change the subject to something a little less common than "sleeper". Maybe a unique letter number combo. Not any of your passwords of course! ;)

I would also have it mail me a return message verifying that mail received the message and ran the script.



[ Reply to This | # ]
Sleep a Mac with a text or email message
Authored by: NeoX on Jan 02, '07 09:46:53PM

Of course if your Mac is asleep I don't think it is going to be able to send you a return email saying it is asleep. hehe



[ Reply to This | # ]
Sleep a Mac with a text or email message
Authored by: BohrMe on Jan 02, '07 01:16:54PM

That's easy! I want to see that machine receive a wake up or boot up message!

;-)



[ Reply to This | # ]
Sleep a Mac with a text or email message
Authored by: billjjones on Jan 02, '07 06:44:06PM

For the people who want to wake up a machine by email...

I have a dmz machine running on my home network, it's always on when I'm away. I can install things like this tip on it and it can turn around and do things like issue wake up commands for other machines that I don't want left on, like a G5 or a laptop.

If I left something on a home machine and I'm on the road - I can always get to it.



[ Reply to This | # ]
Much easier!
Authored by: tice on Jan 02, '07 10:17:23PM
It's much easier to set your Mac to sleep: Just make an AppleScript rule in Mail pointing to this:

tell application "Finder"
sleep
end tell


That's it. ; )


[ Reply to This | # ]
Much easier!
Authored by: ronnythefiddle on Jan 10, '07 08:22:45PM

I'd like to thank both MurphyM & tice for their combined efforts!

You see, though it may be quicker/easier to use tice's example, in fact the combination of MurphyM's example and tice's teaches (relatively) newbie Mac users keen to expand our knowledge (& reduce the 80/20 effect a few percent!) a thing or two.

In this case how to achieve the same thing using automator for those who can't be bothered/don't have time to learn the applescript basics v the no. steps required/power/flexibility etc of making the effort to learn.

MurphyM encourages us to try using several cool features which (like me) many may have seen but not used because they have no idea where to start. Whereas tice shows us that with some effort we can all improve on our newly found knowledge, and in some lucky situations within a few posts on the same forum!!

But seriously, it's just this sort of info that inspires experimentation and eventually increased understanding.

Either that or a buggered computer!



[ Reply to This | # ]