The conversation on this page has been archived and is no longer active.

How to deep-sleep via command line?

Message #1 - Posted 2003/07/21 - Steven Kan

My G4/450DP running 10.2.6 will deep-sleep if I press the power button or if I select Sleep from the Apple menu, but if I just let it sit there for 30-60 minutes, it only goes into light sleep (e.g. screen goes dark and drives spin down, but the fans stay on).

Aside from fixing the specific problem, how do I tell my Mac to deep sleep via the command line? (e.g. when SSH'ed in from a remote location). Thanks!

Message #2 - Posted 2003/07/21 - Frederick Cheung

On 21 Jul 2003, Steven Kan wrote:

My G4/450DP running 10.2.6 will deep-sleep if I press the power button or if I select Sleep from the Apple menu, but if I just let it sit there for 30-60 minutes, it only goes into light sleep (e.g. screen goes dark and drives spin down, but the fans stay on).

Aside from fixing the specific problem, how do I tell my Mac to deep sleep via the command line? (e.g. when SSH'ed in from a remote location). Thanks!

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

But i think this might not work if there is no user logged in graphically.

Fred

Message #3 - Posted 2003/07/21 - Sandman

Previously, Steven Kan wrote:

My G4/450DP running 10.2.6 will deep-sleep if I press the power button or if I select Sleep from the Apple menu, but if I just let it sit there for 30-60 minutes, it only goes into light sleep (e.g. screen goes dark and drives spin down, but the fans stay on).

Aside from fixing the specific problem, how do I tell my Mac to deep sleep via the command line? (e.g. when SSH'ed in from a remote location). Thanks!

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

Unfortunately, this only works if the Finder is running (i.e. someone is logged in).

Sandman[.net]

Message #4 - Posted 2003/07/21 - Steve Lidie

Sandman wrote:

Previously, Steven Kan wrote:

My G4/450DP running 10.2.6 will deep-sleep if I press the power button or if I select Sleep from the Apple menu, but if I just let it sit there for 30-60 minutes, it only goes into light sleep (e.g. screen goes dark and drives spin down, but the fans stay on).

Aside from fixing the specific problem, how do I tell my Mac to deep sleep via the command line? (e.g. when SSH'ed in from a remote location). Thanks!

Typically, sleep kills network connections, so you shall have hung yourself, as it were. Nevertheless:

man -k power

leads to:

man pmset

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

Unfortunately, this only works if the Finder is running (i.e. someone is logged in).

Message #5 - Posted 2003/07/21 - Tom Stiller

Previously, Steve Lidie wrote:

Sandman wrote:

Previously, Steven Kan wrote:

My G4/450DP running 10.2.6 will deep-sleep if I press the power button or if I select Sleep from the Apple menu, but if I just let it sit there for 30-60 minutes, it only goes into light sleep (e.g. screen goes dark and drives spin down, but the fans stay on).

Aside from fixing the specific problem, how do I tell my Mac to deep sleep via the command line? (e.g. when SSH'ed in from a remote location). Thanks!

Typically, sleep kills network connections, so you shall have hung yourself, as it were. Nevertheless:

man -k power

leads to:

man pmset

Which won't do what the OP wants.

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

Unfortunately, this only works if the Finder is running (i.e. someone is logged
in).

Tom Stiller

PGP fingerprint = 5108 DDB2 9761 EDE5 E7E3
7BDA 71ED 6496 99C0 C7CF

Message #6 - Posted 2003/07/22 - Sandman

Previously, Steve Lidie wrote:

Sandman wrote:

Previously, Steven Kan wrote:

My G4/450DP running 10.2.6 will deep-sleep if I press the power button or if I select Sleep from the Apple menu, but if I just let it sit there for 30-60 minutes, it only goes into light sleep (e.g. screen goes dark and drives spin down, but the fans stay on).

Aside from fixing the specific problem, how do I tell my Mac to deep sleep via the command line? (e.g. when SSH'ed in from a remote location). Thanks!

Typically, sleep kills network connections, so you shall have hung yourself, as it were. Nevertheless:

Your SSH connection dies, yes, but that's not a problem.

man -k power

leads to:

man pmset

Which is a command line utility for setting power management settings. It's identical to the energy saver preference pane in functionality. And you can't use it to tell the machine to sleep.

Sandman[.net]

Message #7 - Posted 2003/07/22 - Steven Kan

steven@kan.org (Steven Kan) wrote in message news:<b133d89.0307210900.1bd7cae5@posting.google.com>...

My G4/450DP running 10.2.6 will deep-sleep if I press the power button or if I select Sleep from the Apple menu, but if I just let it sit there for 30-60 minutes, it only goes into light sleep (e.g. screen goes dark and drives spin down, but the fans stay on).

[snip]

Also, any tips on how to fix the sleeping problem? The Energy Saver prefs are set with Separate Sleep for display un-checked and Spin Down HDs unchecked.

Thanks!

Message #8 - Posted 2003/07/22 - Steven Kan

Sandman <mr@sandman.net> wrote in message news:<mr-32FF50.21241521072003@news.fu-berlin.de>...

Previously, Steven Kan wrote:

My G4/450DP running 10.2.6 will deep-sleep if I press the power button or if I select Sleep from the Apple menu, but if I just let it sit there for 30-60 minutes, it only goes into light sleep (e.g. screen goes dark and drives spin down, but the fans stay on).

Aside from fixing the specific problem, how do I tell my Mac to deep sleep via the command line? (e.g. when SSH'ed in from a remote location). Thanks!

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

this only works if the Finder is running (i.e. someone is logged in).

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Does this mean logged in graphically, or would my SSH login qualify? Is there any way I can trigger a graphical login from my SSH session and _then_ tell it to go to sleep?

Message #9 - Posted 2003/07/23 - Sandman

Previously, Steven Kan wrote:

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

this only works if the Finder is running (i.e. someone is logged in).

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Does this mean logged in graphically, or would my SSH login qualify?

No, the Finder needs to be running, which it doesn't if no one is logged in 'grapichally'

Is there any way I can trigger a graphical login from my SSH session and _then_ tell it to go to sleep?

I don't think so no.

Sandman[.net]

Message #10 - Posted 2003/07/23 - Frederick Cheung

On Wed, 23 Jul 2003, Sandman wrote:

Previously, Steven Kan wrote:

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

this only works if the Finder is running (i.e. someone is logged in).

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Does this mean logged in graphically, or would my SSH login qualify?

No, the Finder needs to be running, which it doesn't if no one is logged in 'grapichally'

Is there any way I can trigger a graphical login from my SSH session and _then_ tell it to go to sleep?

I don't think so no.

you can send a sleep appleevent to the loginwindow process but you can't talk to it via applescript, so writing a small program that does that might work. However i seem to recall that sending applevents from a process not run by a graphically logged in user is kinda icky.

Fred

Need Help? Have a Question?

Looking for more help, comments, and answers?

Ask your questions on Ask Different. Ask Different is a community of Apple users ready to help.