We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpPrograms › restarting a program automatically after a crash.
Page Index Toggle Pages: 1
restarting a program automatically after a crash. (Read 368 times)
restarting a program automatically after a crash.
Oct 7th, 2008, 6:30am
 
is it possible to have a processing program automatically restart after a crash?

(ie. for a program that runs for long periods of time unsupervised)


ive been reading and it seems that this is possible to do with AppleScript, but as i dont know applescript i would have no idea where to begin.

any suggestions?
Re: restarting a program automatically after a cra
Reply #1 - Oct 7th, 2008, 1:13pm
 
The best way is to ensure the sketch won't crash! :-P

Joke aside, it might be interesting to see why it might crash. Often, in Java, it is because resources (memory...) are exhausted. Which can be because you allocate memory you never release, even if it is no longer unused (memory leak), for example.

You mention AppleScript, I suppose you plan to run your sketch on Macintosh computers, I fear that's beyond my domain of competence.
But on any system, I think the strategy is to have a side process checking if the main process is still in memory. If not, just restart it!
On a Mac, maybe you can do that with a cron which run shell script doing a pgrep and running the sketch if not found.
Page Index Toggle Pages: 1