Cron job from 9am to 5pm EVERY day

Viewed 237

I wrote a schedule/cron job with the following expression

"0 9-17 * * *"

as I wanted it to run everyday from 9am to 5pm, every hour. However the callback function was only executed for day 1 and not for everyday.

const job = schedule.scheduleJob("0 9-17 * * *", async () => {
// my code
})

Please do highlight my mistake.

1 Answers

this should help you with the issue -> https://cron.help/every-5-minutes-between-9-and-5

If you want cronjob to run everyday between 9 to 5 and lets say each 5 miuntes it would be like this:

*/5 9-17 * * *

If you want to run it every minutes you should do something like:

*/1 9-17 * * *

To run it between 9-17 each hour use:

*/60 9-17 * * *

enter image description here

Related