Forum Discussion

Livius's avatar
Livius
Icon for Altostratus rankAltostratus
Sep 12, 2018

Crontab not working

Hi all,

 

Trying to set up a rotating tcpdump on F5 , I added the following entries in crontab :

 

0,15,30,45 * * * * pkill tcpdump 0,15,30,45 * * * * tcpdump -ni 0.0:nnnp -s0 host x.x.x.x or host y.y.y.y or host z.z.z.z -w /var/tmp/2518/2518_v4_`date +%Y%m%d%H%M%S`.pcap

 

I cannot manage to have it running. What am I missing?

 

1 Reply

  • Hello,

    I advise you to proceed like that (don't use pkill tcpdump 0,15,30,45 ... instead use timeout as shown below):

    So first of specify when you want to trigged your tcpdump, you can use an online generator:

    https://www.freeformatter.com/cron-expression-generator-quartz.html

    Then use command

    timeout (sec)
    in order to setup how many times you want to capture (suppose 5 sec), you will obtain (crontab every 10 minutes):

    */10 * * * *

    timeout 5
    tcpdump -ni 0.0:nnnp -s0 host x.x.x.x or host y.y.y.y or host z.z.z.z -w /var/tmp/2518/2518_v4_`date +%Y%m%d%H%M%S`.pcap

    Keep me update regards