I have several perl scripts that run as cronjobs that launch TBRED
basic applications. The problem is one of my many programs is hanging
and when it does it keeps eating more and more resources. The other
problem is the hung processes will only have BASIC as its description.

So I am looking into writting a perl app that will write out the real
perl program name, basic process ID, start time. When the program
finishes it would remove the file. This way I can come in and if a
program is hung i can look at the log file and see right away which
program is causing the problems.

To achive this I am looking at the fork command but I am confused on
the output. The program and its output are at bottom of the mail.

First please explain why the PID prints twice when I only have one
print statement and it is not in a loop.

Second let me know if there is a better way to solve my problem.

TIA,
Paul

Code
-------
#!/bin/perl

use strict;
use warnings;

defined( my $pid = fork ) or die "Cannot fork: $!";
print "pid:$pid\n";
unless( $pid ) {
  exec "date";
  die "cannot exec date: $!";
}


Output
-----------
bash-2.03$ perl testpid.pl
pid:0
Mon May  9 10:19:07 EDT 2005
pid:20995

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to