On Thursday 10 February 2005 11:46 am, Jeremy Kitchen wrote: > I was unable to find where I should post patches on the sourceforge page, > so I'm posting it here :)
err... *cough* NOW I'm posting it here :) it is also available on the web at http://scriptkitchen.com/qmail/freshclam-foreground.patch -Jeremy -- Jeremy Kitchen ++ Systems Administrator ++ Inter7 Internet Technologies, Inc. [EMAIL PROTECTED] ++ www.inter7.com ++ 866.528.3530 ++ 815.776.9465 int'l kitchen @ #qmail #gentoo on EFnet IRC ++ scriptkitchen.com/qmail GnuPG Key ID: 481BF7E2 ++ jabber:[EMAIL PROTECTED]
freshclam-foreground.patch run freshclam with the -f flag along with -d and -c ## to keep freshclam in the foreground. Example: freshclam --daemon-notify=/usr/local/etc/clamav.conf --stdout -d -f -c 12 Uses: piping freshclam output to a logger, such as multilog running freshclam under DJB's daemontools package Related links: http://cr.yp.to/daemontools/multilog.html <-- multilog http://cr.yp.to/daemontools.html <-- daemontools. Thanks to Ken Jones for providing the code, and thanks to me for making the patch :) HOW TO APPLY: tar -zxf clamav-0.8x.tar.gz cd clamav-0.8x patch -p1 < ../freshclam-foreground.patch (configure,make,make install as usual) We have been using this patch since clamav 0.70 and have never had any problems with it. Consider it highly tested. Jeremy Kitchen - 20050210 - [EMAIL PROTECTED] diff -urN clamav-0.82/docs/man/freshclam.1.in clamav-0.82-foreground/docs/man/freshclam.1.in --- clamav-0.82/docs/man/freshclam.1.in 2005-01-26 11:36:18.000000000 -0500 +++ clamav-0.82-foreground/docs/man/freshclam.1.in 2005-02-10 12:13:21.306892072 -0500 @@ -40,6 +40,9 @@ \fB\-d, \-\-daemon\fR Run in a daemon mode. This option requires \-\-checks. .TP +\fB\-f, \-\-foreground\fR +Run daemon in foreground. Useful for supervising freshclam with daemontools or runit. +.TP \fB\-p FILE, \-\-pid=FILE\fR Save daemon's pid in FILE. .TP diff -urN clamav-0.82/freshclam/freshclam.c clamav-0.82-foreground/freshclam/freshclam.c --- clamav-0.82/freshclam/freshclam.c 2005-01-24 14:06:39.000000000 -0500 +++ clamav-0.82-foreground/freshclam/freshclam.c 2005-02-10 12:15:50.834160472 -0500 @@ -283,7 +283,7 @@ } bigsleep = 24 * 3600 / checks; - daemonize(); + if(!optc(opt, 'f')) daemonize(); if (optc(opt, 'p')) { pidfile = getargc(opt, 'p'); } else if ((cpt = cfgopt(copt, "PidFile"))) { @@ -420,7 +420,6 @@ void help(void) { - mprintf_stdout = 1; mprintf("\n"); @@ -437,6 +436,7 @@ mprintf(" --config-file=FILE read configuration from FILE.\n"); mprintf(" --log=FILE -l FILE log into FILE\n"); mprintf(" --daemon -d run in daemon mode\n"); + mprintf(" --foreground -f run daemon in foreground\n"); mprintf(" --pid=FILE -p FILE save daemon's pid in FILE\n"); mprintf(" --user=USER -u USER run as USER\n"); mprintf(" --no-dns force old non-DNS verification method\n"); diff -urN clamav-0.82/freshclam/options.c clamav-0.82-foreground/freshclam/options.c --- clamav-0.82/freshclam/options.c 2004-08-31 19:48:58.000000000 -0400 +++ clamav-0.82-foreground/freshclam/options.c 2005-02-10 12:10:15.794094304 -0500 @@ -38,7 +38,7 @@ int ret, opt_index, i, len; struct optstruct *opt; - const char *getopt_parameters = "hvdp:Vl:c:u:"; + const char *getopt_parameters = "hvdp:Vl:c:u:f"; static struct option long_options[] = { /* @@ -54,6 +54,7 @@ {"log", 1, 0, 'l'}, {"log-verbose", 0, 0, 0}, /* not used */ {"stdout", 0, 0, 0}, + {"foreground", 0, 0, 'f'}, {"daemon", 0, 0, 'd'}, {"pid", 1, 0, 'p'}, {"user", 1, 0, 'u'}, /* not used */
pgpfTX6cuC1gO.pgp
Description: PGP signature
_______________________________________________ http://lists.clamav.net/cgi-bin/mailman/listinfo/clamav-devel