Wireshark-users: Re: [Wireshark-users] how to run tcpdump on background
From: Flako <subforos@xxxxxxxxx>
Date: Tue, 2 Oct 2012 16:56:08 -0300
2012/10/2 Guy Harris <guy@xxxxxxxxxxxx>:
>
> On Oct 2, 2012, at 11:10 AM, esolve esolve <esolvepolito@xxxxxxxxx> 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.
>

You Send It output to a log file.
This command generates log files of 700MB

	tcpdump -n -i eth0 -s 65535 -w tcpdump-$HOSTNAME-$(date
+"%Y%m%d-%H%M").log -C 700&