Wireshark mailing list archives

Re: how to run tcpdump on background


From: Guy Harris <guy () alum mit edu>
Date: Tue, 2 Oct 2012 11:24:14 -0700


On Oct 2, 2012, at 11:10 AM, esolve esolve <esolvepolito () gmail com> wrote:

I have a script where I want to run tcpdump and then immediately run another command
however, tcpdump will cause the shell pause/hang
so the following command lines will have no chance to run

even if I use &, it doesn't help
like

[root@ket capture]#  tcpdump -i eth0 -w temp &
[2] 32076
[root@ket capture]# tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes


it always switches to foreground even with &

Why do you think it's in the foreground?  The fact that it prints to the (pseudo-)terminal doesn't mean that - 
background jobs can write to the terminal (unless you do "stty tostop", which means they'll stop if they try to write 
to the terminal, but that's not what you want), they just can't *read from* the terminal without stopping.

If you don't want the "listening on..." message printed, you'd have to redirect the standard error of tcpdump to 
/dev/null (which means you won't see any error messages it prints) or to a file (in which case that message *and* any 
error messages will show up in the file).
___________________________________________________________________________
Sent via:    Wireshark-users mailing list <wireshark-users () wireshark org>
Archives:    http://www.wireshark.org/lists/wireshark-users
Unsubscribe: https://wireshark.org/mailman/options/wireshark-users
             mailto:wireshark-users-request () wireshark org?subject=unsubscribe


Current thread: