[mrtg-developers] [RFE] [PATCH] NoDetach configuration option

Georgi Georgiev chutz at gg3.net
Sun Jun 20 09:18:42 MEST 2004


I am running mrtg under daemontools. They do a god job at restarting the child
process (mrtg) when necessary, but mrtg has to run in the foreground for that
purpose.

I would like to request the addition of another configuration option, that
would prevent the mrtg daemon process from detaching from the console.

The modifications I made to my local copy of mrtg are trivial:

--- mrtg-2.10.14/bin/mrtg	2004-06-09 06:08:28.000000000 +0900
+++ mrtg-2.10.14/bin/mrtg	2004-06-20 15:56:37.367381851 +0900
@@ -293,7 +293,8 @@
     my $curent_time;
     my $sleep_time;
     if (defined $opts{"daemon"}) { $cfg{'runasdaemon'} = "yes"; }
-    &demonize_me($pidfile,$cfgfile) if defined $cfg{'runasdaemon'}  and $cfg{'runasdaemon'} =~ /y/i  and $MRTG_lib::OS ne 'VMS';
+    &demonize_me($pidfile,$cfgfile) if defined $cfg{'runasdaemon'}  and $cfg{'runasdaemon'} =~ /y/i  and $MRTG_lib::OS ne 'VMS'
+    	and not (defined $cfg{'nodetach'} and $cfg{'nodetach'} =~ /y/i);
     # auto restart on die if running as demon
 
     $SIG{__DIE__} = sub {
diff -ru mrtg-2.10.14.old/lib/mrtg2/MRTG_lib.pm mrtg-2.10.14/lib/mrtg2/MRTG_lib.pm
--- mrtg-2.10.14/lib/mrtg2/MRTG_lib.pm	2004-06-09 06:08:28.000000000 +0900
+++ mrtg-2.10.14/lib/mrtg2/MRTG_lib.pm	2004-06-19 21:47:57.770270991 +0900
@@ -129,6 +129,9 @@
        'runasdaemon' =>
        [sub{1}, sub{"Internal Error"}],
 
+       'nodetach' =>
+       [sub{1}, sub{"Internal Error"}],
+
        'maxage' =>
        [sub{(($_[0] =~ /^[0-9]+$/) and ($_[0] > 0)) },
         sub{"$_[0] must be a Number bigger than 0"}],

-- 
*>   Georgi Georgiev   *> Don't sweat it -- it's only ones and         *>
<*    chutz at gg3.net    <* zeros. -- P. Skelly                          <*
*>  +81(90)6266-1163   *>                                              *>

--
Unsubscribe mailto:mrtg-developers-request at list.ee.ethz.ch?subject=unsubscribe
Help        mailto:mrtg-developers-request at list.ee.ethz.ch?subject=help
Archive     http://www.ee.ethz.ch/~slist/mrtg-developers



More information about the mrtg-developers mailing list