[Greylist-users] Patch to daemonize relaydelay v0.04

Martin A. Walker maw at synesis.net
Tue Jul 29 13:48:08 PDT 2003


Hi all,

Here's a context diff against relaydelay version 0.04 that does the
following:

1. Provides a Redhat style /etc/rc.d/init.d/relaydelay startup script
that works with chkconfig and prints the usual pretty output on startup
and shut down. So you can just cp it to /.etc/rc.d/init.d and do a
chkconfig --add relaydelay. 2. Adds 2 new options to the conf file:
$run_as_daemon (which is self explanatory) and $log_file so you can
still have all the verbose output dumped into a file instead of
appearing all over STDOUT, which is fine when running as a foreground
app, but a pain if it's a daemon. The $log_file option also caused me to
change a couple of diagnostic messages slightly. For example, I
obviously couldn't output the "Loading Config File" message to a log
file before I knew from the config file where to write the log file.
Apart from this last (functionally insignificant) change in the
messages, if these new options are not set, relaydelay will behave
exactly as before. 3. A couple of bits of diagnostic output, for example
"Attempting to unlink local UNIX socket...", are now only output if
$verbose is on. Sorry if anyone doesn't like this change, it just made
sense to me... 4. As well as forking a properly daemonized child to do
the actual work, then exiting, a signal handler is installed to handle a
SIGQUIT gracfully, i.e. A message for the log, a db_disconnect(), and an
exit. In case anyone's wondering, I chose SIGQUIT for this because I
quite simply couldn't get SIGTERM or SIGHUP to work this way. I think
the Milter engine must be masking them or something because they just
get ignored. SIGQUIT works fine, but if anyone has any idea why the
others won't I'd be grateful for the insight. 5. Finally I changed the
code for a couple of error conditions from using print then exit to
using die, really just to make the style consistent.

I've been running the above in production (Redhat 7.3, with perl 5.8.0)
for a day or so without any apparent problems so far. It also seems to
work fine on my Redhat 8.0 test box.

Herewith then, the patch...

-------------- next part --------------
A non-text attachment was scrubbed...
Name: relaydelay-0.04.patch
Type: application/octet-stream
Size: 8118 bytes
Desc: not available
Url : http://lists.puremagic.com/pipermail/greylist-users/attachments/20030729/aefcb4e0/relaydelay-0.04.obj


More information about the Greylist-users mailing list