Monday, 17 August 2009

Lingon - keep max open

The other day I needed to find a way to restart Max automatically on OSX. For a project at work we're using Max 5 in an installation - many different sub patches are loaded dynamically by a scheduler throughout the day. The machine (a Mac pro) restarts every night, but I wanted to make Max restart as soon as it crashed, so as to minimise the downtime. We were experiencing seemingly random crashes that didn't appear to be linked to any specific piece or any specific time of day. The crashes seem to happen once or twice a month at random times and with different crash reports, even though the same schedule was played every day, therefore it was almost impossible to debug.

In order to keep Max running I used a program called Lingon which allows you to automatically restart a program once it's crashed. It's an interface to the OSX launchd daemon. The developer seems to have abandoned the project but you can still download it from here:


You can download my "keepmaxopen" launchd script here:


Once you've installed Lingon, you can put this plist file in ~/Library/LaunchAgents/

Launch Lingon, and in the section labelled myagents it should show com.olilarkin.keepmaxopen.plist. Check the enable button and restart your computer.


Now Max will boot automatically when you restart. Try quitting Max, and you will find it launches again. This is a potentially dangerous situation if you build a patch that crashes straight away as it will keep on crashing/restarting/crashing/restarting forever until you disable the script!

No comments:

Post a Comment