View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide

Advice for running SC in installations

Home   How To   Code Pool   Public Library   Theory   Events
Many people use SC as part of multimedia installations. Sometimes they share some of the wisdom they have accumulated, on how to do this well. The sc-users list is a good place to overhear this wisdom. Some tips collected here:

Overnight shutdowns

Advice from Sciss:

Advice from David

Checking for server crashes and dealing with them

These won't happen often, of course :) but installations typically need a lot of uptime when you add it all up, so you need to be prepared.

One way to watch for a server crash (recommended by Sciss):

Updater( Server.default, { arg server, what ... args; if( what ===
\serverRunning and: { server.serverRunning.not }, { "Yukk, gotta
reboot!".debug })});

...and modified by felix so it doesn't panic too quickly (the server may occasionally fail to respond quickly, e.g. if loading lots of buffers)...
Updater(server,{ arg s, message;
                               if(message == \serverRunning and: {s.serverRunning.not},{
                                       AppClock.sched(5.0,{ // don't panic too quickly
                                                       "Server dead ?".inform;
                                                       //this.cmdPeriod; // stop everything, she's dead

Remove the updater before you quit the server when the installation is shut down (i assume it's shut down once a day? i would recommend this!>). i recommend setting Server -> aliveThreadPeriod to something like 2 seconds so in case the server gets really busy by accident, it doesn't cause your code to try to boot and reinitialize everything.

Here's another way (by Joshua):

a = {
	my 40-50 lines of code;

a.value; // run the piece{
				("Rebooted at " ++ Date.getDate).postln;
			}, {
			"still running".postln; // don't actually include this... just  
handy to make sure the Routine works
		10.wait; // do this every 10 seconds


(Recommended by Sciss):

here's my code for that:

	// note : must be called on the AppClock thread
	*storePostWin {
		var d, f;
		d = Document.listener;
		try {
			f = File( dataFolder ++ "log" ++ Date.getDate.stamp ++ ".txt", "w" );
			f.write( d.text );
		} {
			arg error; error.postln;

and the shutdown method:

	shutDown { arg powerDown = true;
		"Cleaning up...".inform;
		... (your clean up code here)

		"Quitting server...".inform;
		"Storing post window log...".inform;
		if( powerDown, {
			"Shutting down computer...".inform;
			unixCmd( "osascript -e 'tell application \"Finder\" to shut down'" );

If your machine's on internet, you can send your logs per email ;-)) i have never done this though

Configuring things for stability

Sciss said::

David said:

Tommi said::


(Recommended by Sciss):

Autoboot Linux SC

See here: Autoboot into emacs -sclang

Links to this Page