From: Michael Gernoth Date: Thu, 17 Dec 2009 15:20:35 +0000 (+0100) Subject: fork fork away X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/upsgraph/commitdiff_plain/6aa53fc5257183707fa0e2f56fb210b1fadad7a6?ds=sidebyside;hp=e18c93b30560e68d91bd34f298dc9d8903929b97 fork fork away --- diff --git a/upsgraph.pl b/upsgraph.pl index 745a44c..073a439 100755 --- a/upsgraph.pl +++ b/upsgraph.pl @@ -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 .= "\"";