How to deep-sleep via command line?

Steven Kan wrote on :

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!

Frederick Cheung replied on :

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

Sandman replied on :

In article b133d89.0307210900.1bd7cae5@redacted.invalid, steven@redacted.invalid (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).

Steve Lidie replied on :

Sandman mr@redacted.invalid wrote:

In article b133d89.0307210900.1bd7cae5@redacted.invalid, steven@redacted.invalid (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).

Tom Stiller replied on :

In article bfhmlm$qho@redacted.invalid, Steve Lidie lusol@redacted.invalid wrote:

Sandman mr@redacted.invalid wrote:

In article b133d89.0307210900.1bd7cae5@redacted.invalid, steven@redacted.invalid (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).

Sandman replied on :

In article bfhmlm$qho@redacted.invalid, Steve Lidie lusol@redacted.invalid wrote:

Sandman mr@redacted.invalid wrote:

In article b133d89.0307210900.1bd7cae5@redacted.invalid, steven@redacted.invalid (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.

Steven Kan replied on :

steven@redacted.invalid (Steven Kan) wrote in message news:b133d89.0307210900.1bd7cae5@redacted.invalid...

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!

Steven Kan replied on :

Sandman mr@redacted.invalid wrote in message news:mr-32FF50.21241521072003@redacted.invalid...

In article b133d89.0307210900.1bd7cae5@redacted.invalid, steven@redacted.invalid (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?

Sandman replied on :

In article b133d89.0307221621.3fdc7968@redacted.invalid, steven@redacted.invalid (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.

Frederick Cheung replied on :

On Wed, 23 Jul 2003, Sandman wrote:

In article b133d89.0307221621.3fdc7968@redacted.invalid, steven@redacted.invalid (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