]> cvs.zerfleddert.de Git - upsgraph/commitdiff
fork fork away
authorMichael Gernoth <michael@gernoth.net>
Thu, 17 Dec 2009 15:20:35 +0000 (16:20 +0100)
committerMichael Gernoth <michael@gernoth.net>
Thu, 17 Dec 2009 15:20:35 +0000 (16:20 +0100)
upsgraph.pl

index 745a44cbe2dae92c4a3b7d3ea17bbab1417a35e1..073a43950fdcee69dd8e6fd8320956eace370fc0 100755 (executable)
@@ -110,6 +110,12 @@ if (! -e "${rrdfile}") {
        print `${cmd}`;
 }
 
+my $child = fork();
+
+die "fork failed!" if (!defined($child));
+
+exit 0 if ($child != 0);
+
 while(1) {
        ($session,$error) = Net::SNMP->session(Hostname => $host,
                        Community => $community);
@@ -137,7 +143,6 @@ while(1) {
                if (!(defined($vars->{$var}->{'value'}))) {
                        $vars->{$var}->{'value'} = 'U';
                }
-               print $vars->{$var}->{'name'}.": ".$vars->{$var}->{'value'}."\n";
                $cmd .= ":" . $vars->{$var}->{'value'};
        }
        $cmd .= "\"";
Impressum, Datenschutz