From f004592ac75253abcb2e32548ddb995f10ff9cf2 Mon Sep 17 00:00:00 2001 From: Michael Gernoth Date: Thu, 11 Feb 2010 09:19:48 +0100 Subject: [PATCH 1/1] don't warn when the initial graph is nonexistant --- upsgraph.pl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/upsgraph.pl b/upsgraph.pl index 05553fd..1fbb452 100755 --- a/upsgraph.pl +++ b/upsgraph.pl @@ -337,7 +337,7 @@ while(1) { print "Error while graphing: " . RRDs::error . "\n"; } else { my $newmtime=(stat("${outdir}/${hostname}.${var}.png.work"))[9]; - if ($newmtime != $mtime) { + if ((!defined($mtime)) || ($newmtime != $mtime)) { copy("${outdir}/${hostname}.${var}.png.work", "${outdir}/${hostname}.${var}.png.new"); rename("${outdir}/${hostname}.${var}.png.new", "${outdir}/${hostname}.${var}.png"); } @@ -371,7 +371,7 @@ while(1) { print "Error while graphing: " . RRDs::error . "\n"; } else { my $newmtime=(stat("${outdir}/${hostname}.${var}.long.png.work"))[9]; - if ($newmtime != $mtime) { + if ((!defined($mtime)) || ($newmtime != $mtime)) { copy("${outdir}/${hostname}.${var}.long.png.work", "${outdir}/${hostname}.${var}.long.png.new"); rename("${outdir}/${hostname}.${var}.long.png.new", "${outdir}/${hostname}.${var}.long.png"); } @@ -388,7 +388,7 @@ while(1) { print "Error while graphing: " . RRDs::error . "\n"; } else { my $newmtime=(stat("${outdir}/${hostname}.${var}.week.png.work"))[9]; - if ($newmtime != $mtime) { + if ((!defined($mtime)) || ($newmtime != $mtime)) { copy("${outdir}/${hostname}.${var}.week.png.work", "${outdir}/${hostname}.${var}.week.png.new"); rename("${outdir}/${hostname}.${var}.week.png.new", "${outdir}/${hostname}.${var}.week.png"); } @@ -405,7 +405,7 @@ while(1) { print "Error while graphing: " . RRDs::error . "\n"; } else { my $newmtime=(stat("${outdir}/${hostname}.${var}.year.png.work"))[9]; - if ($newmtime != $mtime) { + if ((!defined($mtime)) || ($newmtime != $mtime)) { copy("${outdir}/${hostname}.${var}.year.png.work", "${outdir}/${hostname}.${var}.year.png.new"); rename("${outdir}/${hostname}.${var}.year.png.new", "${outdir}/${hostname}.${var}.year.png"); } -- 2.39.5