From: Stephen L Johnson Date: Fri, 15 Dec 2000 21:39:57 +0000 (+0000) Subject: added --test param which is passed to spong-message for test mode of msg'ing. X-Git-Tag: spong-2_7_2~38 X-Git-Url: http://git.etc.gen.nz/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=875554f557dba6b7bf1b6aba6ab3b4858361610e;p=spong.git added --test param which is passed to spong-message for test mode of msg'ing. --- diff --git a/pod/spong-server.pod b/pod/spong-server.pod index 2930257..0d7a570 100644 --- a/pod/spong-server.pod +++ b/pod/spong-server.pod @@ -4,7 +4,8 @@ B - save status information reported by spong programs =head1 SYNOPSIS -B [B<--debug> I] [B<--kill|--restart>] [F] +B [B<--debug> I] [B<--kill|--restart>] [-B<--test>] + [F] =head1 DESCRIPTION @@ -32,6 +33,11 @@ B process that is currently running. It will release reload it's configuration and restart. If the B<--kill> flag if provided, a signal will be sent to the running B process causing it to exit. +The B<--test> parameter has no effect in the B program itself. +If specified on the comment line, the B<--test> parameter will be passed +to the B program when it is called. The <--test> paramter +will cause B to skip the actual send of notifications. + An alternate configuration file can be specified on the command line. This file will be read instead of the default F configuration file. diff --git a/src/spong-server.pl b/src/spong-server.pl index c513e68..fb01648 100755 --- a/src/spong-server.pl +++ b/src/spong-server.pl @@ -6,7 +6,7 @@ # There are one or more update processes that listen for status updates # from client programs. -# $Id: spong-server.pl,v 1.32 2000/12/15 21:13:14 sljohnson Exp $ +# $Id: spong-server.pl,v 1.33 2000/12/15 21:39:57 sljohnson Exp $ use lib "@@LIBDIR@@"; @@ -36,7 +36,7 @@ $MAX_CHILDREN = 10; $debug = $restart = $kill = 0; if (! GetOptions("debug:i" => \$debuglevel, "restart" => \$restart, - "kill" => \$kill ) ) { + "kill" => \$kill "test" => \$test) ) { &usage(); exit 1; } @@ -1126,12 +1126,12 @@ sub send_message { my ( $host, $service, $color, $time, $sum, $duration ) = @_; if ( -f $smessage ) { - if ( $debug < 3 ) { - system $smessage, $color, $host, $service, $time, $sum, $duration; - } else { - system $smessage, '--debug', $color, $host, $service, $time, $sum, - $duration; - } + my args; + push @args,$smessage; + if( $debug >= 3 ) { push @args,'--debug'; } + if( $test ) { push @args,'--test'; } + push @args, $color, $host, $service, $time, $sum, $duration; + system(@args); } else { &error( "could not send message, $smessage not found" ); }