Hi there, thanks for reading this! I’m new to apple scripting, started reading a little bit arround about it… I need a small script that reboots a mac after let’s say 3 hours, over and over again. Because on that mac runs an ‘unstable apogee create 2 distiller’ (that creates pdf’s in the pdf workflow we have over here) and sometimes the distiller just quits or hangs, so at night when there’s nobody here, jobs don’t continue… So if the computer would reboot every 3 hour, and I put the script and the program in my startup folder, it should startover again…
I made this small script, and tought that was it, but it’s not working, it reboots the Mac directly, not waiting for the timeout…
Who can help me, I’ve been reading arround about timeout commando and variants, but can’t find a solution…
Many thanks in advance!
cheers,
Dietrich
with timeout of 10800 seconds
tell application “Finder” to restart
end timeout
Or, a better substitute for the “delay 10800” statement would be:
do shell script "sleep 10800"
Which seems a less-CPU-intensive routine (useless if you are not running OS X).
However I think this will fail if your machine falls asleep. The best tool I know to schedule my restarts, shutdowns and startups is iBeeZz, which can also run compiled scripts (also useless out of OS X). You can find a list with some specific tools for OS 9 here: http://macscripter.net/faq/general.php?id=P46
If you configured your compute to “never sleep” you can use the delay+restart code, or use a subroutine to check if Distiller is running, and launch it again if needed.
on idle
tell application "Finder"
if (name of every process) does not contain "Acrobat Distiller" then launch application "Acrobat Distiller"
end tell
return 60 --> run this code every 1 minute
end idle
Thanks a lot for your post, your answer was what I was hoping for! I’ve downloaded the starters book for apple scripting and started reading it, and I’m sure I’ll get more into it, but for now my problem is already solved because of you…
Many thanks for your help!