Sceniro.
I have many cron jobs that run perl scripts. These perl scripts launch
TbredBasic Applications. The problem I keep finding these processes
hung but I have noway of finding out which program is actually causing
the problem. When the tbredbasic application launches the processes
name is always BASIC.

I wanted to write a program that would write out the process id and
the perl program that spawned it to a file then destroy that file when
the program fails. This way I can just look at the "log" and see that
program X is what keeps hanging.

So I have been experminting with the fork command but I am confused as
to the out put I get. Below is the code and its output follows. First
please explain why the pid prints twice and second let me know if
there is a better way to achive what I am trying to do.

TIA
Paul

#!/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: $!";
}

--
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