Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

creating a watchdog to relaunch app on crash

I'm running an adobe air app, and in the case that it crashes, I'd like to have it relaunch automatically. I have no idea about how this would work, but I've seen it done by a developer in Windows XP.

If that's a piece of cake, then here's another one. If someone force quits safari, can I make the computer restart or relaunch safari instantly? Alternately, do you know of a way to keep Safari from closing at all (this in for a web-only kiosk in a lobby at a museum)?

Thanks for any advice you can give!

Apple, Mac OS X (10.6.2), Computer

Posted on Nov 23, 2010 7:52 AM

Reply
Question marked as Best reply

Posted on Nov 23, 2010 8:48 AM

Since you're here, I'll assume an Applescript solution:

Be sure to "Save As" "Application" and check "Stay Open"


<pre style="
font-family: Monaco, 'Courier New', Courier, monospace;
font-size: 10px;
font-weight: normal;
margin: 0px;
padding: 5px;
border: 1px solid #000000;
width: 720px;
color: #000000;
background-color: #E6E6EE;
overflow: auto;"
title="this text can be pasted into the AppleScript Editor">
repeat
tell application "System Events"
if name of every process does not contain "Safari" then tell application "Safari" to launch
end tell
delay 5
end repeat</pre>
3 replies
Question marked as Best reply

Nov 23, 2010 8:48 AM in response to czechokeflavik

Since you're here, I'll assume an Applescript solution:

Be sure to "Save As" "Application" and check "Stay Open"


<pre style="
font-family: Monaco, 'Courier New', Courier, monospace;
font-size: 10px;
font-weight: normal;
margin: 0px;
padding: 5px;
border: 1px solid #000000;
width: 720px;
color: #000000;
background-color: #E6E6EE;
overflow: auto;"
title="this text can be pasted into the AppleScript Editor">
repeat
tell application "System Events"
if name of every process does not contain "Safari" then tell application "Safari" to launch
end tell
delay 5
end repeat</pre>

Nov 23, 2010 8:54 AM in response to czechokeflavik

czechokeflavik wrote:
Alternately, do you know of a way to keep Safari from closing at all (this in for a web-only kiosk in a lobby at a museum)?


Never used it but take a look at: http://haoli.dnsalias.com/Saft/index.html
"Saft is a Safari plugin to add features like draggable tabs, full-screen browsing, searchable bookmarks and history, URL shortcuts, *kiosk mode* and more. "

Nov 23, 2010 9:58 AM in response to czechokeflavik

Personally, I find that sort of thing super annoying. However, it's trivial to implement. Simply write a small app that calls system() to launch your Air application. When system() returns, evaluate the signal and error codes that it returns. If they indicate an error, loop back and restart the application. In PERL , but the logic holds for anything:


my $command = "/Applications/Safari.app/Contents/MacOS/Safari";
do {
system(COMMAND);
} while ($? & 127 or $? >> 8)

creating a watchdog to relaunch app on crash

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.