make lazy really work...
authorMichael Gernoth <michael@gernoth.net>
Wed, 10 Feb 2010 21:54:26 +0000 (22:54 +0100)
committerMichael Gernoth <michael@gernoth.net>
Wed, 10 Feb 2010 21:54:26 +0000 (22:54 +0100)
upsgraph.pl

index cc98e64969e01ee37284ba0d07d816299222f38a..04a4f8c751bc15f8747374ed48f40a86bf337b02 100755 (executable)
@@ -8,6 +8,7 @@ if ((@ARGV != 1) && (@ARGV != 2)) {
 use Net::SNMP;
 use IO::Socket::INET;
 use RRDs;
+use File::Copy;
 use Data::Dumper;
 
 $UPSGRAPH::outdir = "";
@@ -331,7 +332,7 @@ while(1) {
                        if (RRDs::error) {
                                print "Error while graphing: " . RRDs::error . "\n";
                        } else {
-                               rename("${outdir}/${hostname}.${var}.png.new", "${outdir}/${hostname}.${var}.png");
+                               copy("${outdir}/${hostname}.${var}.png.new", "${outdir}/${hostname}.${var}.png");
                        }
 
                        print HTML "<a href=\"${hostname}.${var}.html\"><img src=\"${hostname}.${var}.png\" width=\"${width}\" height=\"${height}\" border=\"0\"></a><br>\n";
@@ -360,7 +361,7 @@ while(1) {
                        if (RRDs::error) {
                                print "Error while graphing: " . RRDs::error . "\n";
                        } else {
-                               rename("${outdir}/${hostname}.${var}.long.png.new", "${outdir}/${hostname}.${var}.long.png");
+                               copy("${outdir}/${hostname}.${var}.long.png.new", "${outdir}/${hostname}.${var}.long.png");
                        }
 
                        print HTML2 "<img src=\"${hostname}.${var}.long.png\" width=\"${width}\" height=\"${height}\"><br>";
@@ -372,7 +373,7 @@ while(1) {
                        if (RRDs::error) {
                                print "Error while graphing: " . RRDs::error . "\n";
                        } else {
-                               rename("${outdir}/${hostname}.${var}.week.png.new", "${outdir}/${hostname}.${var}.week.png");
+                               copy("${outdir}/${hostname}.${var}.week.png.new", "${outdir}/${hostname}.${var}.week.png");
                        }
 
                        print HTML2 "<img src=\"${hostname}.${var}.week.png\" width=\"${width}\" height=\"${height}\"><br>";
@@ -384,7 +385,7 @@ while(1) {
                        if (RRDs::error) {
                                print "Error while graphing: " . RRDs::error . "\n";
                        } else {
-                               rename("${outdir}/${hostname}.${var}.year.png.new", "${outdir}/${hostname}.${var}.year.png");
+                               copy("${outdir}/${hostname}.${var}.year.png.new", "${outdir}/${hostname}.${var}.year.png");
                        }
 
                        print HTML2 "<img src=\"${hostname}.${var}.year.png\" width=\"${width}\" height=\"${height}\"><br>";
Impressum, Datenschutz