Re: Checking for App running and restart if not
Re: Checking for App running and restart if not
- Subject: Re: Checking for App running and restart if not
- From: Michael Grant <email@hidden>
- Date: Thu, 22 Jan 2004 22:46:52 -0600
On Jan 22, 2004, at 5:55 PM, Dan Doughtie wrote:
I've got a critical app running under 10.2.6 Server (on an Xserve)
that has
a nasty habit of crashing when I manage to get a day away from the
office.
Never habits when I'm at the office. I need some kind of timed
approach that
can check every 5 minutes to see if the app is running and if not then
relaunch. I think a cron approach is best and have it run an
Applescript.
I have cron call the following script once every five minutes via the
osascript command:
-- begin script
property appList : {{theApp:"iKey",
thePath:"/Users/mgrant/Applications/iKey.app/Contents/MacOS/iKey"},
{theApp:"Meteorologist",
thePath:"/Users/mgrant/Applications/M/Meteorologist/Meteorologist.app/
Contents/MacOS/Meteorologist"}}
repeat with anApp in appList
set cmd1 to "ps -x | grep " & (theApp of anApp) & " | wc -l"
set cmd2 to (thePath of anApp)
try
if (do shell script cmd1) as integer < 3 then do shell script
(thePath of anApp)
end try
end repeat
-- end script
I suspect this would actually be easier as a pure shell script (i.e.
without AppleScript), but I don't have much experience with those.
Michael
--
I believe there's something out there watching over us. Unfortunately,
it's the government.
- Woody Allen
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.