home *** CD-ROM | disk | FTP | other *** search
- #!/usr/local/bin/perl
- #
- # find zombies' parents
- #
-
- die "can't open ps PIPE" unless open(ps,"ps axlww|");
-
- $header = <ps>;
- print $header;
-
- while (<ps>) {
- chop;
- split(' ');
- $procs{$_[2]} = $_;
- }
-
- $procline[1] = 0;
-
-
- while (($pid,$procline) = each(procs)) {
- next unless ( $procline =~ /<(exiting|defunct)>/ );
- do {
- print $procline . "\n";
- @procline = split(' ',$procline);
- $pid = $procline[3];
- $procline = $procs{$pid};
- } until ( $pid < 3 );
- }
-