Permalink
Browse files

Modified to continue running if it can't find a rollrec, it'll just s…

…leep

until it's available.

It also will only log the missing rollrec once every five checks, in order to
not fill up the log with too many extraneous messages.   Five isn't a magic
number; it was chosen as an assumed reasonable number.  This can be increased
or lowered if desired.


git-svn-id: https://www.dnssec-tools.org/svn/dnssec-tools/trunk@6742 c4029f9c-b713-0410-a448-fae9e31a314a
  • Loading branch information...
1 parent 90bc91d commit 2fd7efc0a329bfec35abbb8ff6afa52b4013da8d tewok committed Apr 27, 2012
Showing with 52 additions and 9 deletions.
  1. +52 −9 dnssec-tools/tools/scripts/rollerd
@@ -68,7 +68,7 @@ use POSIX qw(setuid);
# Version information.
#
my $NAME = "rollerd";
-my $VERS = "$NAME version: 1.12.4";
+my $VERS = "$NAME version: 1.12.5";
my $DTVERS = "DNSSEC-Tools Version: 1.12";
#######################################################################
@@ -262,6 +262,13 @@ my $queued_hup = 0; # Queued-SIGHUP flag.
my $ret; # Return code from main().
my $runerr; # Execution error -- used in runner().
+#
+# If we find the rollrec file is empty, we'll give an error message
+# only on an occasional pass through the zone list.
+#
+my $MAXRRFERRS = 5; # Number of list passes to stay quiet.
+my $rrferrors = 0; # Count of times through list.
+
#
# Detect required Perl modules.
#
@@ -439,7 +446,7 @@ sub eminent_domains
if(!rrfokay($rrf,""))
{
rolllog_log(LOG_FATAL,'',"rollrec file \"$rrf\" invalid");
- exit(61);
+ return(0);
}
#
@@ -4019,12 +4026,12 @@ sub optsandargs
}
#
- # Whine and die if the rollrec file doesn't exist.
+ # Whine if the rollrec file doesn't exist.
#
- if(! -e $rollrecfile)
+ if(!rrfokay($rollrecfile,""))
{
- print STDERR "rollerd: rollrec file \"$rollrecfile\" does not exist\n";
- $opterrs++;
+ print STDERR "rollerd: rollrec file \"$rollrecfile\" does not exist\n\n";
+ print STDERR "rollerd: not stopping execution; waiting for a rollrec\n";
}
#
@@ -4373,17 +4380,47 @@ sub rrfokay
{
my $rrf = shift; # Rollrec file to check.
my $mp = shift; # Message prefix.
+ my $ret = 1; # Return code.
+ my $err; # Error message.
+ #
+ # Check that the file exists and is non-zero in length. If one of
+ # those conditions fails, we'll set an error message and return code.
+ #
if(! -e $rrf)
{
- rolllog_log(LOG_ERR,$mp,"rollrec file \"$rrf\" does not exist");
- return(0);
+ $err = "rollrec file \"$rrf\" does not exist";
+ $ret = 0;
}
elsif(-z $rrf)
{
- rolllog_log(LOG_ERR,$mp,"rollrec file \"$rrf\" is zero length");
+ $err = "rollrec file \"$rrf\" is zero length";
+ $ret = 0;
+ }
+
+ #
+ # If we found an error, we'll (maybe) give an error message and
+ # bump our error count.
+ #
+ if($ret == 0)
+ {
+ if($rrferrors == 0)
+ {
+ rolllog_log(LOG_ERR,$mp,$err);
+ $rrferrors = $MAXRRFERRS;
+ }
+ else
+ {
+ $rrferrors--;
+ }
+
return(0);
}
+
+ #
+ # Reset our error count and return success.
+ #
+ $rrferrors = 0;
return(1);
}
@@ -6849,6 +6886,12 @@ B<-autosign>/B<-noautosign> command line options. If B<rollerd> is configured
to not perform automatic re-signing, the administrator can still get this
controlled behavior by use of the B<zonesigner> or B<rollctl> commands.
+If the B<rollrec> file does not exist or is of zero length, B<rollerd> will
+give an error message and continue running. It will periodically wake up and
+check for a usable B<rollrec> file. Once it finds the specified B<rollrec>
+file exists and isn't empty, then it will proceed with normal rollover
+management.
+
=head2 ZSK Rollover Using the Pre-Publish Method
The Pre-Publish Method has four phases that are entered when it is time to

0 comments on commit 2fd7efc

Please sign in to comment.