I'm not sure, probably by forking and execing. It won't return the result
code from the other program though.
$some_process = 'tcpdump -v -ieth0 >file';
my $pid = fork();
unless ($pid) {
exec($some_process);
die "Can't start $some_process: $!";
}
print "Pid is $pid\n";
-----Original Message-----
From: Harry Putnam [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 02, 2004 3:34 PM
To: [EMAIL PROTECTED]
Subject: How to capture pid
What is the handy way to record the pid of $some_process in this
fake code?
$some_process = 'tcpdump -v -ieth0 >file')
system("$some_process") or die "Can't start $some_process: $!";
print "Pid is $pid\n";
The process is started by a more elaborate perl script at bootup.
and restarted every four hours from syslog. Code above is way simplified.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>