Problem is that i get zombies..... The main Program must run because it runs as a daemon so i can't exit it to cleanup my zombie prozesses........ ps aux |grep Z USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root 307 0.0 0.0 0 0 pts/1 Z+ 19:27 0:00 a2.pl <defunct> root 319 0.0 0.0 0 0 pts/1 Z+ 19:27 0:00 a2.pl <defunct> root 324 0.0 0.0 0 0 pts/1 Z+ 19:28 0:00 a2.pl <defunct> root 334 0.0 0.0 0 0 pts/1 Z+ 19:28 0:00 a2.pl <defunct> root 353 0.1 0.0 0 0 pts/1 Z+ 19:28 0:00 a2.pl <defunct> root 381 0.0 0.0 0 0 pts/1 Z+ 19:28 0:00 a2.pl <defunct> root 404 0.2 0.0 0 0 pts/1 Z+ 19:28 0:00 a2.pl <defunct> root 421 0.0 0.0 9852 872 pts/2 S+ 19:28 0:00 grep Z
Main Perl String #!/usr/bin/perl -w use strict; use warnings; use IPC::Cmd qw[can_run run run_forked]; my $timeout = 1; my $erg; my $cmd='/home/a2.pl'; while(1){ if( scalar run( command => $cmd, verbose => 0, buffer => \$erg +, timeout => $timeout )){ print 'success:'.$erg."\n"; }else{ if(!$erg){ $erg='ERROR'; } print 'timeout cmd:'.$cmd.' ergr='.$erg."\n"; } sleep(5); } 1; /home/a2.pl #!/usr/bin/perl print 10000; #print 'or some text.....'; 1;
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |