简体   繁体   中英

node-cron run job every 3 hours

I am trying to run a node-cron job every 3 hours and I am not sure if I am doing it right.

Right now I am using:

* * */8 * * *

Is this correct?

You should zero-out the second and minute values, and use a step of /3. The cron expression for this is

0 0 */3 * * *

Which evaluates to 'At 0 seconds, 0 minutes every 3rd hour'.

Your current expression * * */8 * * * would try to run every second of every minute past every 8th hour.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM