Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Use remote AppleScripts to sleep another machine System
Looking for a way to make my Cube go to sleep from my tiBook, I've found this way to do it:
  1. Activate Remote Apple Events in the Sharing preference pane on the machine you want to control (in my case, a Cube with IP address 192.168.1.2)

  2. From here on, you can either create an AppleScript from the AppleScript Editor, or, what I do, run the osascript utility from Terminal

  3. Enter the following script:
    tell application "Finder" of machine "eppc://192.168.1.2"
    sleep
    end tell
Of course, you can target different applications, different machines and execute difference commands. Also, make sure your network security settings won't allow events from unknown IP numbers.

By the way, this should also work in 10.1
    •    
  • Currently 3.17 / 5
  You rated: 5 / 5 (6 votes cast)
 
[17,581 views]  

Use remote AppleScripts to sleep another machine | 5 comments | Create New Account
Click here to return to the 'Use remote AppleScripts to sleep another machine' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
really ?
Authored by: AntiWendel on Sep 14, '02 03:03:14PM

well fabulous !
i have tried for eons to get the remote eppc to work.
it has never worked tho...
can you also quit apps on your remote machine ?
are you connected on a local or remote (internet) network ?

if you will please email me at anti@antiwendel.se

tx



[ Reply to This | # ]
a few other methods
Authored by: victory on Sep 14, '02 09:28:05PM
Nice hint.
For those who may not be familiar with AppleScript (or don't want to use it), here are two other remote sleep tips (none quite as automatic as patashnik's script, though):
- If you're willing to enable remote shell access, there's a cmd-line app called SleepNow. Do a standard SSH login and run this cmd. It also *may* be possible to assign this cmd as the default shell of a particular account so that you can create a dedicated 'sleep' account much like how traditional Unix systems had captive 'restart' and 'shutdown' accounts.
- Some Mac remote control apps like ARD have a button to put a particular host to sleep. Of course, if you have this level of remote control of a machine in the first place...
BTW, a method I often use to tell whether or a remote machine went to sleep or not is to ping the machine in question from another terminal window or the system 'Network Utility' app. When the pings stop ECHO REPLYing, the host has probably gone to sleep. Since ICMP message handling (that ping uses) exists at a fairly deep level in the OS, it's usually a good indication that the machine has actually gone to bed (versus a server app crashing and becoming unresponsive or something)

[ Reply to This | # ]
a few other methods
Authored by: bluehz on Sep 15, '02 07:32:59AM

A combination of SleepNow and another utility called WakeOnLan - a little cron work on an extra cpu that stays awake all the time and you have yourself the functionaly equivalent of the ol' OS 9 Energy Saver for sleeping/waking machines.



[ Reply to This | # ]
Use remote AppleScripts to sleep another machine
Authored by: LouieNet on Dec 13, '03 06:13:27AM
I'm having some trouble executing the command remotely, but since I have ssh access, I logged into the machine and executed the following command (so it runs as root):

sudo osascript -l AppleScript -e 'tell Application "Finder" to sleep'

If I tried to execute the remote command with a root login, I get a bus error:

osascript -l AppleScript -e 'tell Application "Finder" of machine "eppc://root@192.168.1.11" to sleep'
Bus error

---
G4 cube, 1152M RAM, OS X Server 10.2.8
17" Powerbook G4, 1G RAM, OS X 10.2.8

[ Reply to This | # ]

Use remote AppleScripts to sleep another machine
Authored by: LouieNet on Dec 13, '03 06:18:31AM
Interestingly, if I used the following command, it works...but only after I put the System Administrator password in twice:

sudo osascript -l AppleScript -e 'tell Application "Finder" of machine "eppc://192.168.1.11" to sleep'

---
G4 cube, 1152M RAM, OS X Server 10.2.8
17" Powerbook G4, 1G RAM, OS X 10.2.8

[ Reply to This | # ]