From 37f9b45266acfeb45157d3c27a65979b33c57df7 Mon Sep 17 00:00:00 2001 From: Bernd Arnold Date: Sun, 17 Jun 2018 09:36:13 +0200 Subject: Drop uptime binary call No need to call /bin/uptime, since the string can be generated with strftime(...). diff --git a/plugins-scripts/check_uptime.pl b/plugins-scripts/check_uptime.pl index 0a13cc0..ed859ab 100755 --- a/plugins-scripts/check_uptime.pl +++ b/plugins-scripts/check_uptime.pl @@ -143,7 +143,7 @@ $msg .= "uptime is $uptime_seconds seconds. "; $msg .= "Exceeds $out_of_bounds_text threshold. " if $out_of_bounds_text; $msg .= "Running for $pretty_uptime. " if $opt_f; if ( $opt_s ) { - chomp( my $up_since = `uptime -s` ); + my $up_since = strftime( "%Y-%m-%d %H:%M:%S", localtime( time - $uptime_seconds ) ); $msg .= "Running since $up_since. "; } -- cgit v0.10-9-g596f