• "Sleep" over network

    From Sandman@mr@sandman.net to comp.sys.mac.system on Monday, July 07, 2003 22:55:44
    From Newsgroup: comp.sys.mac.system

    Is there a way to tell my Mac to go to sleep without having physical access to it? I am using wakeonlan to wake it, but I would like to put it to sleep when I'm done with it - is there a command I can use in SSH for example?

    On a similar note - is there a command to put hard drives to sleep?

    --
    Sandman[.net]
    --- Synchronet 3.18b-Win32 NewsLink 1.113
  • From Sander Tekelenburg@user@domain.invalid to comp.sys.mac.system on Tuesday, July 08, 2003 04:28:14
    From Newsgroup: comp.sys.mac.system

    In article <mr-378662.22554407072003@news.fu-berlin.de>,
    Sandman <mr@sandman.net> wrote:

    Is there a way to tell my Mac to go to sleep without having physical
    access to it? I am using wakeonlan to wake it, but I would like to
    put it to sleep when I'm done with it - is there a command I can use
    in SSH for example?

    I haven't tried this, but you can use AppleScript to tell the Finder to
    sleep. So if you'd create an applet like the one below, save it on the
    remote machine, and trigger it from your ssh session ("open [path to applet]"), I'd think that should work.

    tell application "Finder"
    delay 30
    sleep
    end

    Possibly, with your ssh session still active, that might immediately
    wake the remote Mac again. Hence the delay in the script, to give you
    another 30 seconds (or whatever you prefer) to log out before the sleep command hits. But it may not be necessary.

    It should also be possible to do this directly from the terminal. See
    "man osascript".

    --
    Free and shareware at <http://www.euronet.nl/~tekelenb/software/>
    --- Synchronet 3.18b-Win32 NewsLink 1.113
  • From Noses@noses@noses.com to comp.sys.mac.system on Tuesday, July 08, 2003 07:57:33
    From Newsgroup: comp.sys.mac.system

    Sandman <mr@sandman.net> wrote:
    Is there a way to tell my Mac to go to sleep without having physical
    access to it? I am using wakeonlan to wake it, but I would like to put it
    to sleep when I'm done with it - is there a command I can use in SSH for example?

    On a similar note - is there a command to put hard drives to sleep?

    You might take a look at pmset(1); it's not entirely what you want (you can't tell the machine to go to sleep but you can set the sleep timer to something quite low which will permit you to wake it up and reset that value without
    it falling asleep while you are doing it) but it will give you access to the disk spindown timer.


    Noses.
    --- Synchronet 3.18b-Win32 NewsLink 1.113
  • From Sandman@mr@sandman.net to comp.sys.mac.system on Tuesday, July 08, 2003 15:00:45
    From Newsgroup: comp.sys.mac.system

    In article <user-021D2A.04281408072003@news.euro.net>,
    Sander Tekelenburg <user@domain.invalid> wrote:

    In article <mr-378662.22554407072003@news.fu-berlin.de>,
    Sandman <mr@sandman.net> wrote:

    Is there a way to tell my Mac to go to sleep without having physical access to it? I am using wakeonlan to wake it, but I would like to
    put it to sleep when I'm done with it - is there a command I can use
    in SSH for example?

    I haven't tried this, but you can use AppleScript to tell the Finder to sleep. So if you'd create an applet like the one below, save it on the remote machine, and trigger it from your ssh session ("open [path to applet]"), I'd think that should work.

    tell application "Finder"
    delay 30
    sleep
    end

    Possibly, with your ssh session still active, that might immediately
    wake the remote Mac again. Hence the delay in the script, to give you another 30 seconds (or whatever you prefer) to log out before the sleep command hits. But it may not be necessary.

    It should also be possible to do this directly from the terminal. See
    "man osascript".

    Thanks! You got me on the right track. In a SSH session, I can write:

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

    To put the system to sleep. I wish I could, from another system, do:

    ssh hostname sudo osascript -e 'tell application "Finder" to sleep'

    But that doesn't work.

    --
    Sandman[.net]
    --- Synchronet 3.18b-Win32 NewsLink 1.113
  • From Sandman@mr@sandman.net to comp.sys.mac.system on Tuesday, July 08, 2003 15:03:28
    From Newsgroup: comp.sys.mac.system

    In article <bedthd$1alh$4@news.bnc.net>, Noses <noses@noses.com> wrote:

    Sandman <mr@sandman.net> wrote:
    Is there a way to tell my Mac to go to sleep without having physical
    access to it? I am using wakeonlan to wake it, but I would like to put it to sleep when I'm done with it - is there a command I can use in SSH for example?

    On a similar note - is there a command to put hard drives to sleep?

    You might take a look at pmset(1); it's not entirely what you want (you can't tell the machine to go to sleep but you can set the sleep timer to something quite low which will permit you to wake it up and reset that value without
    it falling asleep while you are doing it) but it will give you access to the disk spindown timer.

    Thank you. I soled the go-to-sleep thing with applescript, but I still would like to just spin down the drives... Ah well, not that important I suppose.

    --
    Sandman[.net]
    --- Synchronet 3.18b-Win32 NewsLink 1.113
  • From Bev A. Kupf@bevakupf@ebv.mimnet.northwestern.edu to comp.sys.mac.system on Tuesday, July 08, 2003 14:07:12
    From Newsgroup: comp.sys.mac.system

    On Tue, 08 Jul 2003 15:00:45 +0200,
    Sandman (mr@sandman.net) wrote:
    Thanks! You got me on the right track. In a SSH session, I can write:

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

    To put the system to sleep. I wish I could, from another system, do:

    ssh hostname sudo osascript -e 'tell application "Finder" to sleep'

    The syntax of the command that you have been trying is not quite right.
    You can use ssh from a remote system to get your Mac to sleep. Here is
    one correct command syntax (there are others, but this one will work).

    ssh user@hostname "sudo osascript -e 'tell application \"Finder\" to sleep'"

    Note that you do not have to specify "user@hostname" if you have the same username on both systems, but can use just "ssh hostname .... etc."

    The key is to escape the quotes that "Finder" is within.

    Cheers,
    Bev
    --
    Bev A. Kupf
    Bev's House of Pancakes
    --- Synchronet 3.18b-Win32 NewsLink 1.113
  • From Frederick Cheung@fglc2@srcf.DUH.ucam.org to comp.sys.mac.system on Tuesday, July 08, 2003 15:17:12
    From Newsgroup: comp.sys.mac.system

    On Tue, 8 Jul 2003, Sandman wrote:

    In article <user-021D2A.04281408072003@news.euro.net>,
    Sander Tekelenburg <user@domain.invalid> wrote:

    In article <mr-378662.22554407072003@news.fu-berlin.de>,
    Sandman <mr@sandman.net> wrote:

    Is there a way to tell my Mac to go to sleep without having physical access to it? I am using wakeonlan to wake it, but I would like to
    put it to sleep when I'm done with it - is there a command I can use
    in SSH for example?

    I haven't tried this, but you can use AppleScript to tell the Finder to sleep. So if you'd create an applet like the one below, save it on the remote machine, and trigger it from your ssh session ("open [path to applet]"), I'd think that should work.

    tell application "Finder"
    delay 30
    sleep
    end

    Possibly, with your ssh session still active, that might immediately
    wake the remote Mac again. Hence the delay in the script, to give you another 30 seconds (or whatever you prefer) to log out before the sleep command hits. But it may not be necessary.

    It should also be possible to do this directly from the terminal. See
    "man osascript".

    Thanks! You got me on the right track. In a SSH session, I can write:

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

    To put the system to sleep. I wish I could, from another system, do:

    ssh hostname sudo osascript -e 'tell application "Finder" to sleep'


    it's a shell quoting thingy.
    ssh hostname sudo osascript -e \'tell application \"Finder\" to sleep\'

    should work (at least it does for me)

    Fred

    --- Synchronet 3.18b-Win32 NewsLink 1.113