Re: How to capture pid

2004-03-03 Thread Harry Putnam
zentara <[EMAIL PROTECTED]> writes: > On Tue, 02 Mar 2004 18:07:58 -0600, [EMAIL PROTECTED] (Harry Putnam) > wrote: >> >>For some reason the pid printed does not match the output of ps: >> >>actual sample script" >> >>Note the script outputs 15173 and ps shows 30335 >> >>Do you have an idea what i

Re: How to capture pid

2004-03-02 Thread John W. Krahn
Harry Putnam wrote: > > "John W. Krahn" <[EMAIL PROTECTED]> writes: > > > open FILE, '>file' or die "Cannot open file: $!"; > > my $pid = open DUMP, 'tcpdump -v -ieth0 |' or die "Cannot open pipe from > > tcpdump: $!"; > > print FILE while ; > > close DUMP or die "Cannot close pipe from tcpdump:

Re: How to capture pid

2004-03-02 Thread Harry Putnam
"John W. Krahn" <[EMAIL PROTECTED]> writes: > open FILE, '>file' or die "Cannot open file: $!"; > my $pid = open DUMP, 'tcpdump -v -ieth0 |' or die "Cannot open pipe from > tcpdump: $!"; > print FILE while ; > close DUMP or die "Cannot close pipe from tcpdump: $!"; > close FILE; > > print "Pid was

Re: How to capture pid

2004-03-02 Thread John W. Krahn
Harry Putnam wrote: > > 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: $!"; system() returns false on success and true on failure so "or die ..." will execut

Re: How to capture pid

2004-03-02 Thread Harry Putnam
"Hanson, Rob" <[EMAIL PROTECTED]> writes: > 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_

Re: How to capture pid

2004-03-02 Thread John McKown
On Tue, 2 Mar 2004, Harry Putnam wrote: > > 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

RE: How to capture pid

2004-03-02 Thread Hanson, Rob
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 = 'tcp

How to capture pid

2004-03-02 Thread Harry Putnam
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 fou