Forum OpenACS Q&A: Re: Daemontools disabled error log ... ?

Collapse
Posted by Randy O'Meara on
I'm not sure where you want your error log to appear but it works pretty slick if you use the daemontools multilog program to handle it. It rolls at a specified size and you specify how many historical files you want to keep. In this way, you are *guaranteed* that you can control the maximum storage space used. You will *never* have an exhausted filesystem if you set it up this way. Of course, since it's a DJB tool, it's a bit cryptic. But you can work through that if you download and install the separately published man pages for daemontools.

If you have a directory (or symlink to a directory) named 'log' in your service directory (the same location you placed your daemontools 'run' file), and if that log directory contains a file named 'run' that invokes multilog, then 'supervise' (the daemontools daemon that runs and watches *your* daemon) will automatically control the log file process. I previously published an article in these forums that describes a setup using 'multilog'. You can search for that or look at my postings.

A possible setup may look like this:

  • /service/service0 is a symlink to your openacs root (say /home/servers/service0)
  • your openacs root contains a 'run' script [1]
  • your openacs root contains a symlink named 'log' that points to your log directory (say /var/log/aolserver/service0)
  • your log directory contains a 'run' script [2]

Once you're up and running, you can control log rolling manually if you wish by:

    svc -a /service/service0/log

If for some reason your log isn't showing any content, you may have the file descriptors honked, possibly by moving or removing a log directory while there is an active 'supervise' process directing the flow. In that case, you can straighten things out by:

  • remove your service's symlink from /service
  • svc -xd /home/servers/service0/log
  • svc -xd /home/servers/service0
  • recreate your service's symlink in /service
  • 'svscan' should now automagically restart everything

[1] your service 'run' script
#!/bin/sh
export AOLSERVER_HOME=/home/aolserver
exec 2>&1
exec $AOLSERVER_HOME/bin/nsd -fzt \
    /home/servers/service0/openacs4.tcl \
    -u nsadmin -g web

[2] your log 'run' script
#!/bin/sh
exec setuidgid nsadmin multilog s3999999 +* ./error

Good luck.

Randy