Put mac to sleep from commandline

I want put my apple into the suspend to ram state over the commandline interface. Anybody lnows how to do that?
randolf balasus wrote on :

Hello, I want put my apple into the suspend to ram state over the commandline interface. Anybody lnows how to do that?

For instance the computer is playing music and after two hours all applications should stop and the computer should shutdown. Til now I am using

sleep 120m ; shutdown -h now

that is working fine but it is not required that the computer completely goes down.

thanks Randolf Balasus

Randy Adamczyk replied on :

On 2007-08-18 08:25:33 +0200, randolf balasus rbalasus@redacted.invalid said:

Hello, I want put my apple into the suspend to ram state over the commandline interface. Anybody lnows how to do that?

For instance the computer is playing music and after two hours all applications should stop and the computer should shutdown. Til now I am using

sleep 120m ; shutdown -h now

that is working fine but it is not required that the computer completely goes down.

i don't know the proper unix command to do this, but i use this as a workaround:

download this little sleep automator action [1] and in automator create a script with it. save it as "application", and you'll be able to execute it from the command line with the "open" command.

so long, randy

Randy Adamczyk replied on :

On 2007-08-18 15:42:49 +0200, Randy Adamczyk randy@redacted.invalid said:

download this little sleep automator action [1]

sorry, forgot to paste the link: http://www.apple.com/downloads/macosx/automator/sleep.html

randy

randolf balasus replied on :

Randy Adamczyk wrote:

On 2007-08-18 15:42:49 +0200, Randy Adamczyk randy@redacted.invalid said:

download this little sleep automator action [1]

sorry, forgot to paste the link: http://www.apple.com/downloads/macosx/automator/sleep.html

randy

Thanks this works very well !!!!! that was exaactly what I need. Greetings Randolf Balasus

Calum replied on :

randolf balasus wrote:

Randy Adamczyk wrote:

On 2007-08-18 15:42:49 +0200, Randy Adamczyk randy@redacted.invalid said:

download this little sleep automator action [1]

sorry, forgot to paste the link: http://www.apple.com/downloads/macosx/automator/sleep.html

randy

Thanks this works very well !!!!! that was exaactly what I need. Greetings Randolf Balasus

FWIW, if you still want to do it from the command line, here's one solution: http://www.majid.info/mylos/weblog/2003/12/05-1.html