Command line to put OS X to (deep) sleep?

Steven Kan wrote on :

I'm trying to do some experimentation with Wake-On-LAN with my Mac, and I can't test anything until it's gone to sleep.

The shortest amount of time for sleep in the Energy Saver is 5 minutes, and it takes a long time to test things if I have to wait 5 minutes in between every time!

Is there a command line to put OS X to sleep?

Andrew Forsyth replied on :

On 23-03-2002 23:04, in article 3C9D0928.6792E320@redacted.invalid, "Steven Kan" steven@redacted.invalid wrote:

I'm trying to do some experimentation with Wake-On-LAN with my Mac, and I can't test anything until it's gone to sleep.

The shortest amount of time for sleep in the Energy Saver is 5 minutes, and it takes a long time to test things if I have to wait 5 minutes in between every time!

Is there a command line to put OS X to sleep? Not that I'm aware of, how about an osascript calling an AppleScript function (don't know hat AppleScript function it is)

A.

ZnU replied on :

In article 3C9D0928.6792E320@redacted.invalid, Steven Kan steven@redacted.invalid wrote:

I'm trying to do some experimentation with Wake-On-LAN with my Mac, and I can't test anything until it's gone to sleep.

The shortest amount of time for sleep in the Energy Saver is 5 minutes, and it takes a long time to test things if I have to wait 5 minutes in between every time!

Is there a command line to put OS X to sleep?

Uh.... Can't you just use the sleep command in the Apple menu? Anyway, if you really want to do it from the command line, the only way I know of is to call AppleScript:

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

Tom Stiller replied on :

In article 3C9D0928.6792E320@redacted.invalid, Steven Kan steven@redacted.invalid wrote:

I'm trying to do some experimentation with Wake-On-LAN with my Mac, and I can't test anything until it's gone to sleep.

The shortest amount of time for sleep in the Energy Saver is 5 minutes, and it takes a long time to test things if I have to wait 5 minutes in between every time!

Is there a command line to put OS X to sleep?

The easiest way is to choose Sleep from the Apple menu. If you want aa AppleScript you can:

tell application "Finder" sleep end tell

G.T. replied on :

ZnU wrote:

In article 3C9D0928.6792E320@redacted.invalid, Steven Kan steven@redacted.invalid wrote:

I'm trying to do some experimentation with Wake-On-LAN with my Mac, and I can't test anything until it's gone to sleep.

The shortest amount of time for sleep in the Energy Saver is 5 minutes, and it takes a long time to test things if I have to wait 5 minutes in between every time!

Is there a command line to put OS X to sleep?

Uh.... Can't you just use the sleep command in the Apple menu?

That's probably what he's looking for but that's kind of hard to do from a cron job, eh?

Anyway, if you really want to do it from the command line, the only way I know of is to call AppleScript:

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

Cool.

Greg

ZnU replied on :

In article 3C9D1B3C.8030604@redacted.invalid, "G.T." ethan_t@redacted.invalid wrote:

ZnU wrote:

In article 3C9D0928.6792E320@redacted.invalid, Steven Kan steven@redacted.invalid wrote:

I'm trying to do some experimentation with Wake-On-LAN with my Mac, and I can't test anything until it's gone to sleep.

The shortest amount of time for sleep in the Energy Saver is 5 minutes, and it takes a long time to test things if I have to wait 5 minutes in between every time!

Is there a command line to put OS X to sleep?

Uh.... Can't you just use the sleep command in the Apple menu?

That's probably what he's looking for but that's kind of hard to do from a cron job, eh?

Anyway, if you really want to do it from the command line, the only way I know of is to call AppleScript:

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

Cool.

Well, except that I'm reasonably sure you can't call AppleScript from the command line unless you're logged in as a GUI user, so this won't be useful for cron jobs or remote access.

Andrew Forsyth replied on :

This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible.

--B_3099774699_577445 Content-type: text/plain; charset="US-ASCII" Content-transfer-encoding: 7bit

On 24-03-2002 00:24, in article znu-E049AF.19244523032002@redacted.invalid, "ZnU" znu@redacted.invalid wrote:

In article 3C9D1B3C.8030604@redacted.invalid, "G.T." ethan_t@redacted.invalid wrote:

ZnU wrote:

In article 3C9D0928.6792E320@redacted.invalid, Steven Kan steven@redacted.invalid wrote:

I'm trying to do some experimentation with Wake-On-LAN with my Mac, and I can't test anything until it's gone to sleep.

The shortest amount of time for sleep in the Energy Saver is 5 minutes, and it takes a long time to test things if I have to wait 5 minutes in between every time!

Is there a command line to put OS X to sleep?

Uh.... Can't you just use the sleep command in the Apple menu?

That's probably what he's looking for but that's kind of hard to do from a cron job, eh?

Anyway, if you really want to do it from the command line, the only way I know of is to call AppleScript:

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

Cool.

Well, except that I'm reasonably sure you can't call AppleScript from the command line unless you're logged in as a GUI user, so this won't be useful for cron jobs or remote access.

Try this

#!/bin/zsh -->

call osascript and redirect it's output to the bit bucket

/usr/bin/osascript < /dev/null

tell application "Finder"

sleep

end tell

HERE

A.

--B_3099774699_577445 Content-type: text/html; charset="US-ASCII" Content-transfer-encoding: quoted-printable

--B_3099774699_577445--

David C. replied on :

Steven Kan wrote:

I'm trying to do some experimentation with Wake-On-LAN with my Mac, and I can't test anything until it's gone to sleep.

The shortest amount of time for sleep in the Energy Saver is 5 minutes, and it takes a long time to test things if I have to wait 5 minutes in between every time!

Is there a command line to put OS X to sleep?

I don't know about command-line, but I know that if I push the power button on my G4 tower while the computer's on, it will go to sleep.

-- David

zoara replied on :

Andrew Forsyth a@redacted.invalid wrote:

--B_3099774699_577445 Content-type: text/html; charset="US-ASCII" Content-transfer-encoding: quoted-printable

Please don't post HTML in usenet.

    -z-
Andrew Forsyth replied on :

On 24-03-2002 21:13, in article 1f9k2vi.19e3ce1n0zafhN%not@redacted.invalid, "zoara" not@redacted.invalid wrote:

Andrew Forsyth a@redacted.invalid wrote:

--B_3099774699_577445 Content-type: text/html; charset="US-ASCII" Content-transfer-encoding: quoted-printable

Please don't post HTML in usenet.

  -z-

Unintentional error. Will check settings.

A.

Steven Kan replied on :
Heh! Thanks for all the (incredibly obvious) responses. I'd been stumbling along for so long without a working "sleep" feature, that'd forgotten about the obvious ones!
Kevin Michael Vail replied on :

In article 3C9E7663.C7F00A90@redacted.invalid, Steven Kan steven@redacted.invalid wrote:

Heh! Thanks for all the (incredibly obvious) responses. I'd been stumbling along for so long without a working "sleep" feature, that'd forgotten about the obvious ones!

I start stumbling along when I go too long with a working sleep feature, too.

:-)

zoara replied on :

Andrew Forsyth a@redacted.invalid wrote:

Please don't post HTML in usenet.

  -z-

Unintentional error. Will check settings.

Nice one, cheers.

    -z-