Browse code

add support for Foreground

git-svn-id: file:///var/lib/svn/clamav-devel/trunk/clamav-devel@1334 77e5149b-7576-45b1-b177-96237e5ba77b

Tomasz Kojm authored on 2005/02/13 18:58:40
Showing 7 changed files
... ...
@@ -1,3 +1,8 @@
1
+Sun Feb 13 10:55:35 CET 2005 (tk)
2
+---------------------------------
3
+  * freshclam: add support for Foreground (requested by Jeremy Kitchen
4
+	       <kitchen*scriptkitchen.com>)
5
+
1 6
 Sun Feb 13 09:32:51 GMT 2005 (njh)
2 7
 ----------------------------------
3 8
   * libclamav/message.c:	Some files wouldn't uudecode correctly (reported
... ...
@@ -2192,7 +2192,7 @@ INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
2192 2192
 
2193 2193
 
2194 2194
 LC_CURRENT=1
2195
-LC_REVISION=6
2195
+LC_REVISION=7
2196 2196
 LC_AGE=0
2197 2197
 LIBCLAMAV_VERSION="$LC_CURRENT":"$LC_REVISION":"$LC_AGE"
2198 2198
 
... ...
@@ -22,7 +22,7 @@ AM_INIT_AUTOMAKE(clamav, "devel-`date +%Y%m%d`")
22 22
 AM_CONFIG_HEADER(clamav-config.h)
23 23
 
24 24
 LC_CURRENT=1
25
-LC_REVISION=6
25
+LC_REVISION=7
26 26
 LC_AGE=0
27 27
 LIBCLAMAV_VERSION="$LC_CURRENT":"$LC_REVISION":"$LC_AGE"
28 28
 AC_SUBST(LIBCLAMAV_VERSION)
... ...
@@ -40,6 +40,9 @@ Run as USER. By default (when started by root) freshclam drops privileges and wo
40 40
 \fB\-d, \-\-daemon\fR
41 41
 Run in a daemon mode. This option requires \-\-checks.
42 42
 .TP 
43
+\fB\-f, \-\-foreground\fR
44
+Run daemon in foreground.  Useful for supervising freshclam with daemontools or runit.
45
+.TP
43 46
 \fB\-p FILE, \-\-pid=FILE\fR
44 47
 Save daemon's pid in FILE.
45 48
 .TP 
... ...
@@ -89,3 +89,11 @@ DatabaseMirror database.clamav.net
89 89
 # Run command when database update process fails.
90 90
 # Default: disabled
91 91
 #OnErrorExecute command
92
+
93
+# Don't fork into background.
94
+# Default: disabled
95
+#Foreground
96
+
97
+# Enable debug messages in libclamav.
98
+# Default: disabled
99
+#Debug
... ...
@@ -283,7 +283,10 @@ int freshclam(struct optstruct *opt)
283 283
 	}
284 284
 
285 285
 	bigsleep = 24 * 3600 / checks;
286
-	daemonize();
286
+
287
+	if(!cfgopt(copt, "Foreground"))
288
+	    daemonize();
289
+
287 290
 	if (optc(opt, 'p')) {
288 291
 	    pidfile = getargc(opt, 'p');
289 292
 	} else if ((cpt = cfgopt(copt, "PidFile"))) {
... ...
@@ -420,7 +423,6 @@ void daemonize(void)
420 420
 
421 421
 void help(void)
422 422
 {
423
-
424 423
     mprintf_stdout = 1;
425 424
 
426 425
     mprintf("\n");
... ...
@@ -437,6 +439,7 @@ void help(void)
437 437
     mprintf("    --config-file=FILE                   read configuration from FILE.\n");
438 438
     mprintf("    --log=FILE           -l FILE         log into FILE\n");
439 439
     mprintf("    --daemon             -d              run in daemon mode\n");
440
+    mprintf("    --foreground         -f              run daemon in foreground\n");
440 441
     mprintf("    --pid=FILE           -p FILE         save daemon's pid in FILE\n");
441 442
     mprintf("    --user=USER          -u USER         run as USER\n");
442 443
     mprintf("    --no-dns                             force old non-DNS verification method\n");
... ...
@@ -93,7 +93,7 @@ struct cfgstruct *parsecfg(const char *cfgfile, int messages)
93 93
 	    {"FollowDirectorySymlinks", OPT_NOARG},
94 94
 	    {"FollowFileSymlinks", OPT_NOARG},
95 95
 	    {"ExitOnOOM", OPT_NOARG},
96
-	    {"Foreground", OPT_NOARG},
96
+	    {"Foreground", OPT_NOARG}, /* clamd + freshclam */
97 97
 	    {"Debug", OPT_NOARG},
98 98
 	    {"LeaveTemporaryFiles", OPT_NOARG},
99 99
 	    {"FixStaleSocket", OPT_NOARG},