How to schedule tcpdump to run for a specific period of time?

前端 未结 5 998
我寻月下人不归
我寻月下人不归 2021-01-30 16:28

Each time, when I manually run tcpdump, I have to use Ctrl+C to stop it. Now I want to schedule my tcpdump with cronjob and I onl

5条回答
  •  耶瑟儿~
    2021-01-30 17:17

    You could do it like this:

    tcpdump -i eth0 'port 8080' -w  myfile & 
    pid=$!
    sleep 1.5h
    kill $pid
    

提交回复
热议问题