Friday, April 15, 2011 at 8:24 AM.

myServerFarmSuite.background.everyMinute

<<Changes
	<<4/15/11; 7:46:57 AM by DW
		<<Maintenence flag to reset the backup path on each machine.
	<<2/18/11; 11:31:05 PM by DW
		<<Change FTP prefs on each machine.
	<<11/26/10; 6:06:44 PM by DW
		<<Add call to myServerFarmSuite.apache.buildVhostsConfig.
	<<11/15/10; 10:04:06 PM by DW
		<<Only quit on Windows where we have flaunch.exe running.
	<<11/8/10; 3:19:57 PM by DW
		<<Run every script in everyMinuteScripts table
	<<9/21/10; 10:02:29 AM by DW
		<<Created. 
local (adrdata = myServerFarmSuite.init (), now = clock.now ());
adrdata^.stats.ctEveryMinutes++;
adrdata^.stats.whenLastEveryMinute = clock.now ();
bundle { //write the log if dirty
	if adrdata^.stats.flLogDirty {
		myServerFarmSuite.writeLog ()}};
bundle { //keep flaunch.exe running
	myServerFarmSuite.keepFlaunchExeRunning ()};
bundle { //maintenence checks
	if not defined (adrdata^.flags.fixBackupPath) { //4/15/11 by DW
		
		try {delete (@adrdata^.prefs.myServerFarmFolder)};
		myServerFarmSuite.init (); //force it to reinitialize
		thread.callscript (@myServerFarmSuite.background.everyNight, {});
		
		adrdata^.flags.fixBackupPath = now};
	if not defined (adrdata^.flags.setFtpPrefs) { //2/18/11 by DW
		adrdata^.prefs.ftp.server = "fresca.scripting.com";
		adrdata^.prefs.ftp.username = "dave";
		adrdata^.flags.setFtpPrefs = now};
	if defined (user.scheduler2.everyminute.bootserverfarm) {
		delete (@user.scheduler2.everyminute.bootserverfarm)}};
	<<myServerFarmSuite.maintainers.findEveryMinutes () //only has to run once on each machine
bundle { //look for new statically-served folders
	if not user.prefs.fldevmachine {
		myServerFarmSuite.apache.buildVhostsConfig ()}}; //11/26/10 by DW
bundle { //run every script in everyMinuteScripts table
	local (adrtable = @myServerFarmSuite.everyMinuteScripts, adrscript);
	for adrscript in adrtable {
		while typeof (adrscript^) == addresstype {
			adrscript = adrscript^};
		try {adrscript^ ()}}};
bundle { //quit after a certain number of hits
	if system.environment.isWindows {
		if not user.prefs.fldevmachine {
			local (ctsecondsrunning = now - number (system.temp.myServerFarm.whenLaunched));
			if ctsecondsrunning > (60 * 60 * 24) { //9/25/10 by DW
				filemenu.quit ()};
			if user.webserver.stats.hits > 10000 {
				filemenu.quit ()}}}}



This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.