How to run crontab job every week on Sunday

后端 未结 10 1054
忘掉有多难
忘掉有多难 2020-12-02 04:07

I\'m trying to figure out how to run a crontab job every week on Sunday. I think the following should work, but I\'m not sure if I understand correctly. Is the following cor

相关标签:
10条回答
  • 2020-12-02 04:36
    * * * * 0 
    
    you can use above cron job to run on every week on sunday, but in addition on what time you want to run this job for that you can follow below concept :
    
    * * * * *  Command_to_execute
    - � � � -
    | | | | |
    | | | | +�� Day of week (0�6) (Sunday=0) or Sun, Mon, Tue,...
    | | | +���- Month (1�12) or Jan, Feb,...
    | | +����-� Day of month (1�31)
    | +������� Hour (0�23)
    +��������- Minute (0�59)
    
    0 讨论(0)
  • 2020-12-02 04:39

    When specifying your cron values you'll need to make sure that your values fall within the ranges. For instance, some cron's use a 0-7 range for the day of week where both 0 and 7 represent Sunday. We do not(check below).

    Seconds: 0-59
    Minutes: 0-59
    Hours: 0-23
    Day of Month: 1-31
    Months: 0-11
    Day of Week: 0-6
    

    reference: https://github.com/ncb000gt/node-cron

    0 讨论(0)
  • 2020-12-02 04:39

    Cron job expression in a human-readable way crontab builder

    0 讨论(0)
  • 2020-12-02 04:42

    The crontab website gives the real time results display: https://crontab.guru/#5_8_*_*_0

    0 讨论(0)
提交回复
热议问题