Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Keytachi

macrumors regular
Original poster
Sep 14, 2006
161
0
Is it possible to create an applescript app. that will put the computer to sleep, and wake it right after when a certain error appears on console?
Or in a more simpler way, is it possible to make an applescript app that will reactivate the en0 link?

My computer sometimes (too often) gets an
Code:
AppleYukon2: error -  Uncorrectable PCI Express error
and i need to put it to sleep and wake him to get my internet back (
Code:
11/1/08 2:07:45 PM kernel AppleYukon2 - en0 link active, 100-Mbit, full duplex, symmetric flow control enabled port 0
)

fi anyone could help me, it would be awesome.
 

mysterytramp

macrumors 65816
Jul 17, 2008
1,334
4
Maryland
At least part of the answer is yes. Here's how you can put your computer to sleep:

tell application "Finder"
sleep
end tell

that works, at least through 10.4.11. The finder dictionary puts that in the "legacy" suite, so maybe someday it won't work.

Also, you can:

tell application "Terminal"
set textVar to contents of window 1
end tell

and then you can parse through textVar to find out if you've received an error message, which would trigger the sleep command.

Waking it back up, however, I'm not so sure about. The finder "sleep" command means the computer's asleep, so how can Terminal receive a message? Above my paygrade, sorry. But hopefully, this is a start.

mt
 

Monaj

macrumors regular
May 24, 2009
193
0
sleep not working for remote computer

Hi all,

My problem is simple!

When I use this script, it works fine:

tell application "Finder"
sleep
end tell

but when I use this for remote machine, it gives me error as written below it:

set targetMachine to "eppc://XYZ%20ABC192.168.0.31"
tell application "Finder" of machine targetMachine
sleep
end tell

error "The variable sleep is not defined." number -2753 from "sleep"

Can anyone suggest me: am I wrong anywhere? or sleep does not work for remote computer??

Thanks in advance,

Monaj
 

chown33

Moderator
Staff member
Aug 9, 2009
10,743
8,417
A sea of green
If en0 isn't working, how were you planning to tell the remote machine to sleep and then wake? It seems like the link you need to tell it what to do is the same link that isn't working.

If you're using another interface, such as en1 (WiFi), why not connect internet that way?

The machine where en0 stops working could run a periodic self-check, and if en0 is down it sleeps itself. Wakeup would still be a problem, unless "wake on LAN" is enabled and some other machine sends it a magic packet. Google keywords: mac os wake on lan.

The best long-term solution is to find out why en0 stops working and fix it. Since you haven't identified the model or configuration, I suggest googling: AppleYukon2.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.