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


    Apr 09 2013 | 5:09 pm
    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?

    • Apr 09 2013 | 6:13 pm
      Which OS? You could do this with a shell script on OSX.
    • Apr 09 2013 | 6:21 pm
      I'm using OSX. How does that work with a shell script? I hadn't thought of trying it that way....
    • Apr 09 2013 | 7:44 pm
      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
    • Apr 09 2013 | 9:33 pm
      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!
    • Apr 09 2013 | 9:54 pm
      I would probably check if:
      ps aux | grep Max.app | wc -l
      was greater than 1, and ignore OSC.
      mz