freebsdrocks.net was started originally as nospam.mine.nu.
Have you ever looked at the output of ps axwww (on Linux for example) and
wondered what the readproctitle sericve errors were for?
Did you ever wonder if those messages were current, or 100 days old?
Well, normally there is no way to tell since that is just FIFO a buffer that
does not change unless a new error message gets written to it.
Wouldn't it be nice to either rotate errors out of that buffer, or to timestamp
it so that you can be sure any errors are current?
Here we have a sample listing of a readproctitle service errors buffer:
--[snip]--
readproctitle service errors: ...s not exist?softlimit: fatal: unable to run :
file does not exist?softlimit: fatal: unable to run : file does not
exist?softlimit: fatal: unable to run : file does not exist?softlimit: fatal:
unable to run : file does not exist?softlimit: fatal: unable to run : file
does not exist?softlimit: fatal: unable to run : file does not exist?softlimit:
fatal: unable to run : file does not exist?
--[snip]
We know that the file softlimit exists, and we know that it is being properly
called by full path in our script. So, are these old messages or are they new?
Do we really still have a problem with softlimit, or can we ignore this error
and look elsewhere for the cause of our problem?
- Start off by creating a new supervise directory.
eg: /var/qmail/supervise/readproctitle
- Create an executable script called "run" in that directory. "run" should
look something like this:
#!/bin/sh
echo -n ..`date "+%D-%R"`.. >&2
- Touch the file /var/qmail/supervise/readproctitle/down so that daemontools
does not try to automatically start this process.
- Create the symlink in the service directory:
ln -s /var/qmail/supervise/service
- Run the script and check the output:
svc -o /service/readproctitle
ps axwww | grep readproctitle
You should now see that a current timestamp has been pushed into the end of the
FIFO buffer. Now we are ready to automate this process.
- Now create a cronjob to run this script at any interval you desire. Keep in
mind though, we are going to be putting a timestamp into this FIFO buffer so
the shorter the duration of your cronjob, the sooner actual error messages
will be pushed out of the buffer by timestamps. Here is our sample cronjob
entry:
0 * 0 0 0 root /usr/local/bin/svc -o /service/readproctitle
This will put a timestamp into the readproctitle service errors buffer once
every hour, on the hour.
**note** You may not want ugly timestamps cluttering up yout readproctitle
service errors buffer. You may have a script that parses that buffer expecting
to only see periods and will notify you if there is anything else in that
buffer. In either of these cases, you may simply replace the string in the
readproctitle/run file with one single period.
Special thanks to
William Arlofski
mtnbktATrevpolDOTcom