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

前端 未结 5 1033
我寻月下人不归
我寻月下人不归 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:29

    You can combine -G {sec} (rotate dump files every x seconds) and -W {count} (limit # of dump files) to get what you want:

    tcpdump -G 15 -W 1 -w myfile -i eth0 'port 8080'
    

    would run for 15 seconds and then stop. Turn 1.5 hours into seconds and it should work.

提交回复
热议问题