Hi Experts,
I have a very simple script listed below:
Where ./go_load is binary which runs curl a few times in parallel/serial.
A sample run would look like this:
After the run, the file '/tmp/mytcpdump.pcap' on 198.18.154.133 is empty, which is not expected.
However, if I ran the two cmds manually at the prompt, everything is just fine. A sample manual run is below:
So the final step shows the /tmp/mytcpdump.pcap contains some thing, which is expected and proves all commands are working as designed.
I hope I have made myself clear. Thanks for help.
I have a very simple script listed below:
Code:
#! /usr/bin/perl
my $cmd = "ssh root\@198.18.154.133 \"/a/sbin/tcpdump -v -n -i eth0 port 11640 -w /tmp/mytcpdump.pcap 2>/dev/null\" 2>/dev/null &";
system($cmd);
my $cmd2 = "/usr/bin/ssh root\@198.18.154.130 \"cd /tmp; ./go_load 2>/dev/null\" 2>/dev/null";
system($cmd2);
print "\n";
print "1, \$cmd = $cmd\n";
print "2, \$cmd2 = $cmd2\n";
Where ./go_load is binary which runs curl a few times in parallel/serial.
A sample run would look like this:
Code:
% ./test.pl
0 :[URL unfurl="true"]http://198.18.154.171/[/URL] :200 OK
1 :[URL unfurl="true"]http://198.18.154.171/[/URL] :200 OK
1 :[URL unfurl="true"]http://198.18.154.171/[/URL] :200 OK
1, $cmd = ssh root@198.18.154.133 "/a/sbin/tcpdump -v -n -i eth0 port 11640 -w /tmp/mytcpdump.pcap 2>/dev/null" 2>/dev/null &
2, $cmd2 = /usr/bin/ssh root@198.18.154.130 "cd /tmp; ./go_load 2>/dev/null" 2>/dev/null
After the run, the file '/tmp/mytcpdump.pcap' on 198.18.154.133 is empty, which is not expected.
However, if I ran the two cmds manually at the prompt, everything is just fine. A sample manual run is below:
Code:
Step 1)
% ssh root@198.18.154.133 "ls -l /tmp/mytcpdump.pcap"
ls: cannot access /tmp/mytcpdump.pcap: No such file or directory
Step 2)
% ssh root@198.18.154.133 "/a/sbin/tcpdump -v -n -i eth0 port 11640 -w /tmp/mytcpdump.pcap 2>/dev/null" 2>/dev/null &
[2] 26257
Step 3)
% ssh root@198.18.154.133 "ls -l /tmp/mytcpdump.pcap"
-rw-r--r-- 1 root root 0 Apr 14 04:03 /tmp/mytcpdump.pcap
Step 4)
% ssh root@198.18.154.130 "cd /tmp; ./go_load 2>/dev/null" 2>/dev/null
0 :[URL unfurl="true"]http://198.18.154.171/[/URL] :200 OK
1 :[URL unfurl="true"]http://198.18.154.171/[/URL] :200 OK
1 :[URL unfurl="true"]http://198.18.154.171/[/URL] :200 OK
Step 5)
% ssh root@198.18.154.133 "ls -l /tmp/mytcpdump.pcap"
-rw-r--r-- 1 root root 4096 Apr 14 04:04 /tmp/mytcpdump.pcap
So the final step shows the /tmp/mytcpdump.pcap contains some thing, which is expected and proves all commands are working as designed.
I hope I have made myself clear. Thanks for help.