Archive of UserLand's first discussion group, started October 5, 1998.

Keeping a background Frontier 6/Mac server running smoothly

Author:Dave Winer
Posted:6/19/1999; 1:25:54 PM
Topic:Keeping a background Frontier 6/Mac server running smoothly
Msg #:7581
Prev/Next:7580 / 7582

A couple of weeks ago I installed a virgin copy of Frontier 6 on a Mac system running an old version of Mac System 7. I use the Mac to offload tasks from the NT server, things like batch-loading of the RSS files for My.UserLand.Com and sending Scripting News bulletins.

This server is doing all its work in response to XML-RPC messages, and in timed processes running under the scheduler. Frontier has trouble doing this 7-by-24. It runs out of sockets, or crashes in a "GUSI" routine. Whatever. I'm not sure if the problem is in the TCP routines in the Mac, or in Frontier, and to a major extent it doesn't matter. I just want the server to run smoothly and now I think I have a formula that works, and want to share it.

An AppleScript

First, I wrote an AppleScript that watches to see if Frontier is running, and if not it launches it.

on idle
	tell application "Finder"
		if not (exists application process "UserLand Frontierô") then
			try  
				open application "UserLand Frontierô"
			on error
			end try
		end if
	end tell
	return 10 --run once every 10 seconds
end idle

on run idle {} end run

This script is saved as a runnable application, with an alias in the Startup Items folder so it launches when the system boots. Every ten seconds it checks if Frontier is running and relaunches it.

A Frontier agent that runs every hour

Second, I wrote a Frontier agent that quits every five hours.

if not defined (scratchpad.cthoursrunning)
	scratchpad.cthoursrunning = 0
if scratchpad.cthoursrunning == 5 
	delete (@scratchpad.cthoursrunning) //signal to reset
	filemenu.save ()
	filemenu.quit ()
msg ((5 - scratchpad.cthoursrunning) + " hours till we quit.")
scratchpad.cthoursrunning++
clock.sleepfor (60 * 60) //sleep for an hour

I put the agent at system.agents.quitter.

It works!

You can see that it works from the log on the home page of My.UserLand.Com. It's updating every hour. Now I can move on to tackle other problems.


There are responses to this message:


This page was archived on 6/13/2001; 4:50:55 PM.

© Copyright 1998-2001 UserLand Software, Inc.