Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > macOS > Put computer to sleep remotely via command line?

Put computer to sleep remotely via command line?
Thread Tools
MindFad
Posting Junkie
Join Date: Sep 2001
Status: Offline
Reply With Quote
Aug 22, 2005, 12:39 AM
 
As the title implies, this is what I wish to accomplish. I would like to be able to SSH into my Power Mac to put it to sleep remotely sometimes, but I can't quite seem to find a clear answer on how to do it exactly, and I'm sure one of the fine fellow Mac nerds knows here. Either with some UNIX command, or maybe using Applescript via the command line? Whatever way is easiest—but I wouldn't mind learning more than one way, if just for the sake of knowing.

Thanks, dudes!
     
Nexus5
Mac Enthusiast
Join Date: Nov 2001
Location: fourth sector
Status: Offline
Reply With Quote
Aug 22, 2005, 07:01 AM
 
     
chris v
Addicted to MacNN
Join Date: Jan 2001
Location: The Sar Chasm
Status: Offline
Reply With Quote
Aug 22, 2005, 07:58 AM
 
According to Charles S in the Lounge computer trickery thread, its:

osascript -e 'tell application "System Events" to sleep'

Not sure about the quotes, but maybe he'll pop up here.

When a true genius appears in the world you may know him by this sign, that the dunces are all in confederacy against him. -- Jonathan Swift.
     
CharlesS
Posting Junkie
Join Date: Dec 2000
Status: Offline
Reply With Quote
Aug 22, 2005, 02:51 PM
 
Yep, it's just what you posted above. The quotes are the way they are because AppleScript requires double quotes while the shell can handle either single or double quotes, so if you put the double quotes inside the single quotes, you don't need to escape them.

Keep in mind that as soon as the machine sleeps, your SSH connection will get cut off.

Ticking sound coming from a .pkg package? Don't let the .bom go off! Inspect it first with Pacifist. Macworld - five mice!
     
MindFad  (op)
Posting Junkie
Join Date: Sep 2001
Status: Offline
Reply With Quote
Aug 22, 2005, 06:45 PM
 
Awexome. Exactly what I wanted to perform. No worries about losing the connection. Thank you, Charles.
     
   
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 08:11 PM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,