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?
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?
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".
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.
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'
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'
Sysop: | Gate Keeper |
---|---|
Location: | Shelby, NC |
Users: | 790 |
Nodes: | 20 (0 / 20) |
Uptime: | 41:24:02 |
Calls: | 12,115 |
Files: | 5,294 |
Messages: | 564,934 |