[monitoring-plugins] Fix: uptime_file variable was declared too late

Bernd Arnold git at monitoring-plugins.org
Thu Jul 26 07:40:15 CEST 2018


 Module: monitoring-plugins
 Branch: master
 Commit: 554b702f9d65fdfe640f20633543e00cd79d64ac
 Author: Bernd Arnold <wopfel at gmail.com>
   Date: Sun Jun  3 20:55:42 2018 +0200
    URL: https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=554b702

Fix: uptime_file variable was declared too late

When called with --help, the following error was shown:
Use of uninitialized value $uptime_file in concatenation (.) or string at

---

 plugins-scripts/check_uptime.pl | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/plugins-scripts/check_uptime.pl b/plugins-scripts/check_uptime.pl
index 8c1f3d2..27dc93f 100755
--- a/plugins-scripts/check_uptime.pl
+++ b/plugins-scripts/check_uptime.pl
@@ -1,4 +1,4 @@
-#!@PERL@ -w
+#!/usr/bin/perl -w
 
 # check_uptime - check uptime to see how long the system is running.
 #
@@ -41,6 +41,8 @@ $ENV{'ENV'}='';
 $PROGNAME = "check_uptime";
 $state = $ERRORS{'UNKNOWN'};
 
+my $uptime_file = "/proc/uptime";
+
 
 # Process arguments
 
@@ -54,8 +56,6 @@ if ($status){
 
 # Get uptime info from file
 
-my $uptime_file = "/proc/uptime";
-
 if ( ! -r $uptime_file ) {
 	print "ERROR: file '$uptime_file' is not readable\n";
 	exit $ERRORS{"UNKNOWN"};



More information about the Commits mailing list