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;

In reply to Function for Timing out shell commands without getting Zombie Prozesses by bae11208

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.