From 4aa3c3afed32ac3e9ea9de87c221da4e99fa110a Mon Sep 17 00:00:00 2001 From: Andrew DeFaria Date: Wed, 21 Jun 2017 09:13:11 -0700 Subject: [PATCH] Fixed bug when use -sleep parameter --- bin/checkdns | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/bin/checkdns b/bin/checkdns index a6d93ac..a6fd957 100755 --- a/bin/checkdns +++ b/bin/checkdns @@ -121,6 +121,9 @@ GetOptions ( 'logpath=s' => \$logpath, ) or Usage 'Invalid parameter'; +# Need to reset $initial_sleep if it GetOptions changed it +$initial_sleep = $sleep; + $SIG {INT} = $SIG {TERM} = \&Shutdown; @@ -137,7 +140,11 @@ $log->msg ( "Started $FindBin::Script $VERSION logging to $logpath/$FindBin::Script.log" ); -$log->msg ("Polling DNS on host $host every $sleep minutes"); +if ($sleep > 1) { + $log->msg ("Polling DNS on host $host every $sleep minutes"); +} else { + $log->msg ("Polling DNS on host $host every minute"); +} # if EnterDaemonMode unless get_debug; -- 2.17.1