]> git.zerfleddert.de Git - upsgraph/commitdiff
don't warn when the initial graph is nonexistant
authorMichael Gernoth <michael@gernoth.net>
Thu, 11 Feb 2010 08:19:48 +0000 (09:19 +0100)
committerMichael Gernoth <michael@gernoth.net>
Thu, 11 Feb 2010 08:19:48 +0000 (09:19 +0100)
upsgraph.pl

index 05553fdb45129e51ac599ee863f18fbbfd028486..1fbb452d331588a06e640de00d7a998affee6733 100755 (executable)
@@ -337,7 +337,7 @@ while(1) {
                                print "Error while graphing: " . RRDs::error . "\n";
                        } else {
                                my $newmtime=(stat("${outdir}/${hostname}.${var}.png.work"))[9];
                                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");
                                }
                                        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];
                                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");
                                }
                                        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];
                                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");
                                }
                                        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];
                                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");
                                }
                                        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");
                                }
Impressum, Datenschutz