a Self Rebooting system – for Max Msp?

Jun 16, 2010 at 8:02pm

a Self Rebooting system – for Max Msp?

I want to ask if anyone knows of the computer process-

If a Max Msp patch crashes the computer shuts down and reboots
and on start up ,opens the max msp patch that crashed and runs it.

I am interested in knowing this since I am interested in a permanent installation 1 hour away from my home
and I don’t want to go there everytime something happens.

any ideas? thank you

#50928
Jun 16, 2010 at 8:24pm

I made a kind of that…
Max 5 sends a bang via udp to max 4.6 every minute.
If max5 quits=no bang, and a shell told the computer to restart.
Max 4.6 would just be used to watch max5 and restart computer.

But there must be some real official way to di this :)

#182664
Jun 16, 2010 at 10:09pm

You could write a simple bash script, that reboots if max exits with an error status.
Something like:

#/bin/bash

/Applications/Max5/MaxMSP Runtime.app/Contents/MacOS/MaxMSP Runtime

if [ $? != 0 ]; then
/sbin/reboot
fi

I haven’t tested this, but i thinks it should work.
Of course, with this method you won’t be able to detect, if max hangs.

#182665
Jun 17, 2010 at 1:00am

great, thanks guys, that cover well enough the shut down mechanism. But what about the max msp auto start and patch auto run?

I am using a mac, I think I could put in on start up but that wont execute a specific patch.

#182666
Jun 17, 2010 at 1:14am

If you exported your patch as an actual application, then you could add it to the list of start-up programs like you suggested and it would open that rather than just maxmsp.

#182667
Jun 17, 2010 at 1:25am

I imagine you should be able to run a specific patch on startup if you save the patch as a standalone app?

I saw a mac doing just this in the San Fran Exploratorium with a Max patch. funny thing was, it was frozen when I saw it, so we turned it off and back on, then the patch loaded automatically. Don’t know if it was a standalone, but I think so.

I was really pumped up to see a Max patch in the Exploratorium (because there’s so much potential to use Max in a place like that) but also bummed that it had crashed… it was kind of bittersweet. The patch was pretty lame regardless, there could be so many cooler ones in there…

#182668
Jun 17, 2010 at 2:53am

thanks, yes seejayjames the thing that scares me most about max is unexpected crashes, already had that once happen in an installation and would hate for it to happen again.

I’ve been thinking of learning Processing just because of this.

But thanks to everyone’s replies I now can feel safe even if it crashes, since it can reboot itself

thank you again.

#182669
Jun 17, 2010 at 8:36am

Rather than directly opening the standalone at startup, I’d use an Automator script to introduce a delay before starting the application. Years ago (in the Mac OS X.4 ages), using an m-audio sound card, the audio driver wasn’t available yet when Max opened right after boot.

The undocumented (why?) ; max crash message will help you debugging your reboot procedure.

p

#182670
Jun 17, 2010 at 11:48am

i used to use a little mac program called “keepitup” (seriously). that combined with a max patch (not standalone or collective) set in the ‘open at startup’ preferences (the max patch set to open with MaxRuntime), startup and shutdown times programmed in the prefs (advantage of using mac) and i had a 6 weeks installation with timed startup and shutdown times and no crashing problems. the gallery people hardly had to do anything (apart from amplifiers and the like, which technically you could also automate, although a huge expense and hassle). this solution is a lot simpler than the others mentioned i think, but does require this third party software. which ultimately you could write you own of.

#182671
Jun 17, 2010 at 2:10pm

see this blog post i wrote about restarting max automatically using the launchd daemon (osx only)

http://olilarkin.blogspot.com/2009/08/lingon-keep-max-open.html

if you don’t want to build a standalone and have a max license on the installation machine, you can put the patch in the folder Max5/Cycling74/max-startup, to make it start automatically

#182672
Jun 17, 2010 at 9:32pm

thanks , very useful info.!!

#182673
Jun 25, 2010 at 8:11am

Oli, thanks for this Lingon link. It is very usefull!

pid, KIU is really nice (I used it years ago for a FileMaker server under OS9…) but it doesn’t work with applications without a creator code like Max5 standalones (it does work with Max!). I tried to create one in the .plist but it didn’t work so far (i didn’t try hard). AppleScript or Automator standalones doesn’t work neither.

Still OSX only, Onyx will help you to easily turn the Crash reporter in server mode, so you won’t have an ugly (but harmless) crash window in case your application crashes.

p

#182674
Dec 30, 2010 at 12:16am

if anybody is wondering, i’ve worked out a solution for XP:

http://cycling74.com/forums/topic.php?id=30363

#182675
Dec 30, 2010 at 11:57am

Hey,

I have been using this with mac minis. The script can go to Accounts / Login Items, and it just restarts max runtime and the patch if it crashes. The maxpatch is set to open with Max Runtime, so opening it with /usr/bin/open works just fine.

#! /bin/bash

echo Sleeping for 60 secs
sleep 60
echo Monitoring MaxMSP Runtime
until [ 0 = 1 ]
do
    echo -n Checking ..
    /usr/bin/killall -0 MaxMSP Runtime
    if [ $? = 0 ]
	then
	echo alive.
	else
	echo DEAD - restarting
	/usr/bin/open /Users/jusu/Desktop/maxpatch
	date >> /maxmonitor.log
    fi
    sleep 10
done

Also, you need to disable crash reporting to get rid of the crash dialog. This should work:

defaults write com.apple.CrashReporter DialogType server

If you have XCode, the app CrashReporterPrefs will allow you to set the server mode as well.

#182676
Feb 1, 2012 at 2:04pm

Hey jusu or anyone reading this!

Do you know what I should do with the code jusu talked about?

What program should I run it with?
And where exactly is this “Accounts / Login Items” he is talking about?

Thank you!
ygreq

#182677
Feb 1, 2012 at 5:43pm

***I TAKE NO RESPONSIBILITY IF THIS DOESN’T WORK OR YOU BLOW UP YOUR COMPUTER (BUT SINCE YOU ASKED)****

On Mac OS X:

Copy and paste it into a plain text file, edit the following line to point to your runtime patch:
/Users/jusu/Desktop/maxpatch

Save with a .sh extension, in terminal make the file executable:

chmod 755 ~/relative/path/to/file/from/useraccount/test.sh

Make sure the patch is (in get info) set to open in runtime.
then go into system preferences>accounts, login items, click + and add the script (or just drag it in).

the following you cut and paste into your terminal:

defaults write com.apple.CrashReporter DialogType server

Just to cover my own butt, not to be insulting, don’t screw around with this stuff if you don’t know what you are doing… Read up on it first.

#182678
Feb 2, 2012 at 10:41am

Thank you, cap10subtext !!

I will try that these days and write about it here.

I wish you all the best!
ygreq

#182679

You must be logged in to reply to this topic.