INN commit: branches/2.5 (doc/pod/cnfsstat.pod frontends/cnfsstat.in)

INN Commit rra at isc.org
Wed Sep 24 18:01:11 UTC 2014


    Date: Wednesday, September 24, 2014 @ 11:01:11
  Author: iulius
Revision: 9725

cnfsstat:  add -i flag to specify how many seconds to sleep at startup

Update documentation, and homogenize POD syntax at the same time.

Modified:
  branches/2.5/doc/pod/cnfsstat.pod
  branches/2.5/frontends/cnfsstat.in

-----------------------+
 doc/pod/cnfsstat.pod  |   22 +++++++++++++++-------
 frontends/cnfsstat.in |   13 +++++++++++--
 2 files changed, 26 insertions(+), 9 deletions(-)

Modified: doc/pod/cnfsstat.pod
===================================================================
--- doc/pod/cnfsstat.pod	2014-09-24 17:55:09 UTC (rev 9724)
+++ doc/pod/cnfsstat.pod	2014-09-24 18:01:11 UTC (rev 9725)
@@ -4,13 +4,14 @@
 
 =head1 SYNOPSIS
 
-B<cnfsstat> [B<-ahpPsv>] [B<-c> I<class>] [B<-l> [I<seconds>]] [B<-m> I<buffer>]
+B<cnfsstat> [B<-ahpPsv>] [B<-c> I<class>] [B<-i> I<seconds>]
+[B<-l> [I<seconds>]] [B<-m> I<buffer>]
 
 =head1 DESCRIPTION
 
-I<cnfsstat> reads I<pathetc>/cycbuff.conf and I<pathetc>/storage.conf
+B<cnfsstat> reads I<pathetc>/cycbuff.conf and I<pathetc>/storage.conf
 to determine which CNFS buffers are available.  It then reads the specified
-cyclic buffers and shows their usage status.  I<cnfsstat> can be invoked from
+cyclic buffers and shows their usage status.  B<cnfsstat> can be invoked from
 B<rc.news> if I<docnfsstat> is set to true in F<inn.conf>, and the result is
 written to syslog(3).
 
@@ -20,7 +21,7 @@
 
 =item B<-a>
 
-Besides its usual output, I<cnfsstat> prints the age of the oldest article
+Besides its usual output, B<cnfsstat> prints the age of the oldest article
 in the cycbuff.  You may also want to use the B<-v> flag to see extended
 consistency checks.
 
@@ -32,11 +33,18 @@
 
 Print usage information and exit.
 
+=item B<-i> I<seconds>
+
+With this option, B<cnfsstat> has an initial sleep of I<seconds>
+seconds at startup.  This is useful when B<cnfsstat> is started at
+the same time as INN, so that it can wait a little before beginning
+performing its checks.
+
 =item B<-l> [I<seconds>]
 
-With this option, I<cnfsstat> prints a status snapshot every I<seconds>,
-and only exits if an error occurs.  When unspecified, the default interval
-is C<600> seconds.
+With this option, B<cnfsstat> prints a status snapshot every I<seconds>
+seconds, and only exits if an error occurs.  When unspecified, the
+default interval is C<600> seconds.
 
 At each iteration, B<cnfsstat> checks whether the F<cycbuff.conf> and
 F<storage.conf> files have been modified, and loads the new configuration

Modified: frontends/cnfsstat.in
===================================================================
--- frontends/cnfsstat.in	2014-09-24 17:55:09 UTC (rev 9724)
+++ frontends/cnfsstat.in	2014-09-24 18:01:11 UTC (rev 9725)
@@ -29,12 +29,13 @@
 Summary tool for CNFS
 
 Usage:
-	$0 [-ahpPsv] [-c class] [-l [seconds]] [-m buffer]
+	$0 [-ahpPsv] [-c class] [-i seconds] [-l [seconds]] [-m buffer]
 
 	If called without args, does a one-time status of all CNFS buffers
 	-a:           print the age of the oldest article in the cycbuff
 	-c class:     print out status of CNFS buffers in that class
 	-h:           this information
+	-i seconds:   initial sleep of that many seconds at startup
 	-l [seconds]: loop like vmstat, default seconds = 600
 	-m buffer:    print out information suitable for MRTG
 	-p:           print out an MRTG config file
@@ -54,7 +55,7 @@
 my %opt = (c=>\$oclass, m=>\$obuffer);
 Getopt::Long::config('no_ignore_case');
 GetOptions(\%opt,
-           "-a", "-c=s", "-h", "-l:i", "-m=s",
+           "-a", "-c=s", "-h", "-i=i", "-l:i", "-m=s",
            "-p", "-P", "-s", "-v");
 
 usage() if $opt{'h'};
@@ -96,7 +97,15 @@
 mrtg($obuffer) if $obuffer;
 mrtg_config() if $opt{'p'};
 
+# Initial sleep, before starting the work.
+if(defined($opt{'i'}) && $opt{'i'} > 0) {
+    sleep($opt{'i'});
+    if (!$use_syslog) {
+        print STDOUT "$opt{'i'} seconds later:\n";
+    }
+}
 
+
 START:
 
 # Check whether the configuration files need reloading.



More information about the inn-committers mailing list