Forum OpenACS Q&A: Keeping AolServer Alive on MacOS X

Collapse
Posted by Nick Carroll on
Hi,

How do you keep AolServer alive on MacOS X?  I've set up StartupItems for both PostgreSQL and AolServer.  However the dependencies don't work.  As I have specified that AolServer requires PostgreSQL in the plist file for AolServer.  AolServer seems to load up first, and OpenACS doesn't work, because it can't detect a PostgreSQL database at the time.

Any help would be much appreciated.

Thanks,
Nick.

Collapse
Posted by Walter McGinnis on
What version of OS X are you running?

The reason I ask, is that there is a different mechanism that replaces /Library/Startupitems in Panther.

Collapse
Posted by Nick Carroll on
I'm using MacOS X Server 10.2.8.

I added both Aolserver and Postgresql to the one StartupItem.  This seems to do the job, as I am able to start PostgreSQL before Aolserver.

Collapse
Posted by Nick Carroll on
There is something called watchdog in MacOS X Server Jaguar, which allows processes to be respawned.  I haven't worked out how to use this feature just yet.  But it sounds like something I would want to use.
Collapse
Posted by Barry Books on
The following works for me in /Library/StartupItems/. I have not automated restarts in my run.sh file but I suspect
while true
do

/usr/local/aolserver/bin/nsd -b 0.0.0.0:80 -t /usr/local/aolserver/config.tcl -u postgres $*
sleep 10

done
would work. The sleep just keeps dumb things from happening.

Postgres Start

StartService ()
{
    if [ "${POSTGRES:=-NO-}" = "-YES-" ]; then
            ConsoleMessage "Starting postgres database services"
            su - postgres -c "/usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data/ start -o \"-i\""
    fi
}

Postgres Plist
{
  Description   = "Postgres Database server";
  Provides      = ("PSQL");
  Requires      = ("Resolver");
  Uses          = ("Network Time", "NFS");
  Preference    = "None";
  Messages =
  {
    start = "Starting Postgres";
    stop  = "Stopping Postgres";
    restart  = "Reloading Postgres Configuration";
  };
}


AOL start

StartService ()
{
    if [ "${AOLServer:=-NO-}" = "-YES-" ]; then
            ConsoleMessage "Starting AOLServer"
            /usr/local/aolserver/bin/run.sh
    fi
}


AOLServer Plist
{
  Description   = "AOLServer";
  Provides      = ("AOL");
  Requires      = ("PSQL");
  Uses          = ("Network Time", "NFS");
  Preference    = "None";
  Messages =
  {
    start = "Starting AOLServer";
    stop  = "Stopping AOLServer";
    restart  = "Reloading AOLServer Configuration";
  };
}
Collapse
Posted by Malte Sussdorff on
In the documentation that we provided so far, we wanted to keep it as close to Linux as possible, therefore usage of daemontools has been recommended under OS X as well.

WIth the new version (Panther), this might be a completly different story though, as, if I'm not utterly mistaken, they provide a mechanism for starting/stoping daemons *on demand*. Sadly though, I have not figured it out yet and will most likely not do it within the next couple of days, but if someone has more insights / time to look into this and post comments this would be awesome.