I want to run tcpdump at boot and direct the output to a speicifed file. I then want logrotate to restart that job periodically. I am running Slackware 14.1
I can put the job in /etc/rc.d/rc.local:
tcpdump -tttt -nn portrange 1-4 and 'tcp[13] & 4 != 0' >> /var/log/mylog 2>&1 &
Would that be the best way to do it at start-up? Would I need nohup?
with logrotate I'm thinking:
Code:
/var/log/mylog
{
weekly
rotate 12
sharedschriptes
prerotate
killall tcpdump
endscript
postrotate
tcpdump -tttt -nn portrange 1-4 and 'tcp[13] & 4 != 0' > /var/log/mylog 2>&1 &
endscript
}
Would that work running putting the '&' at the end of the command in the logrotate script?