Search code examples
croncron-task

Linux crontab what is the meaning of the line below?


i have a crontab line and i want to ask some expert what this line will do

10,40 * * * * sh /etc/test/script.sh

please tell me what will 10,40 do in this crontab -e file.i am new to crontab use


Solution

  • *  *  *  *  *  command
    -  -  -  -  -
    |  |  |  |  |
    |  |  |  |  +----- day of week (0 - 6) (Sunday = 0)
    |  |  |  +------- month (1 - 12)
    |  |  +--------- day (1 - 31)
    |  +----------- hour (0 - 23)
    +------------- min (0 - 59)
    

    each position takes a comma-separated list of values.

    this will execute sh /etc/test/script.sh at :10 and :40 every hour. 00:10, 00:40, 01:10, 01:40, ...

    additionally

    you can use / to specify an interval, i.e.

    */5 * * * * sh /etc/test/script.sh
    

    to run it every 5 minutes.

    wikipedia cron page