Forums > MaxMSP

a Self Rebooting system – for Max Msp?

June 16, 2010 | 8:02 pm

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



Ad.
June 16, 2010 | 8:24 pm

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 :)


June 16, 2010 | 10:09 pm

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.


June 17, 2010 | 1:00 am

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.


June 17, 2010 | 1:14 am

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.


June 17, 2010 | 1:25 am

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…


June 17, 2010 | 2:53 am

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.


June 17, 2010 | 8:36 am

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



pid
June 17, 2010 | 11:48 am

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.


June 17, 2010 | 2:10 pm

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


June 17, 2010 | 9:32 pm

thanks , very useful info.!!


June 25, 2010 | 8:11 am

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


December 30, 2010 | 12:16 am

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

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


December 30, 2010 | 11:57 am

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.


February 1, 2012 | 2:04 pm

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


February 1, 2012 | 5:43 pm

***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.


February 2, 2012 | 10:41 am

Thank you, cap10subtext !!

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

I wish you all the best!
ygreq


June 5, 2014 | 1:28 pm

Hi! Im currently searching for some solution too. I am running on a MacBook Pro late 2013 with mavericks installed. Unfortunatly KIU is not supported in my mac… do you know any similar app? I would like to avoid the script that open up max when quitted, just need to open it up when crash (and only for 2 weeks, then I do not care as I can do it by hand). I would have liked an app like KIU as I also need to schedule shut down and start up time… I understand this can be done without an app at all, would just be more convenient maybe… so if anybody have any new tips is much appreciated :)
thanks!


Viewing 18 posts - 1 through 18 (of 18 total)