Launching a specific file when Max/MSP opens, following a crash

Apr 9, 2013 at 5:09pm

Launching a specific file when Max/MSP opens, following a crash

I’m looking at trying to find a way to reopen a specific file if a crash occurs within Max/MSP.

I’m using Lingon to check whether or not Max has crashed, and whenever a crash occurs, it triggers Max to reopen. Which is great for reopening the program itself, the problem being I also want to have a specific patch open when Max reopens. I was wondering if there is some place that I can add something that would allow for this to happen.

Unfortunately this has come up regarding a patch that I can’t turn into a standalone app at this point in time and so I’m hoping to find a way to have this happen as I’ve described above. Anyone have any suggestions?

#67622
Apr 9, 2013 at 6:13pm

Which OS? You could do this with a shell script on OSX.

#243337
Apr 9, 2013 at 6:21pm

I’m using OSX. How does that work with a shell script? I hadn’t thought of trying it that way….

#243338
Apr 9, 2013 at 7:44pm

I used to use a script like:

watcher () {
while [ forever ]
do
	b=0
	export TMOUT=10
	read a b c
	echo "OSC input $a $b $c"
        if [ $b -eq 1 ] ; then
		echo "Installation is running."
	else
		echo "Restarting installation."
 		open -a /Applications/MaxMSP 4.6/MaxMSP.app "/Users/mzed/Desktop/Watchdog/bad_installation.mxb"
 		# The next line sends an alert email
 		#echo "Your installation is being restarted" | mail -s "Restart!" you@somewhere.com
	fi
done
}
dumpOSC -quiet 1750 | watcher

CNMAT’s dumpOSC seems a little difficult to find, though.

I was calling it with cron, although it could be adjusted to run in a loop and sleep between checks.

mz

#243339
Apr 9, 2013 at 9:33pm

Cool. Thanks so much. I’ll check it out… I’m toying around with a couple of other ideas with all of this. The dumpOSC etc is giving some issues, but I may get around that. Thanks again!

#243340
Apr 9, 2013 at 9:54pm

I would probably check if:

ps aux | grep Max.app | wc -l

was greater than 1, and ignore OSC.

mz

#243341

You must be logged in to reply to this topic.