From: Michael Gernoth Date: Thu, 11 Feb 2010 08:19:48 +0000 (+0100) Subject: don't warn when the initial graph is nonexistant X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/upsgraph/commitdiff_plain/f004592ac75253abcb2e32548ddb995f10ff9cf2?hp=5225937733d50608843fbf146b6ddda2b48ca237 don't warn when the initial graph is nonexistant --- 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"); }