0

I would like to run the cron job every 20 minutes between 9 AM and 11 PM and once an hour after 11 PM until 9 AM.

cron job settings

I created 2 cron jobs for the same script to achieve my goal. Did I do it correctly? Thank you.

Aziz
  • 1

1 Answers1

0

Not really. There are two issues:

  1. you run the script also on 23:20 and 23:40
  2. you run the script twice from 09:00 till 23:00 every hour.

The way to do it is:

*/20 9-22   * * * command
0    0-8,23 * * * command

You can validate this using crontab guru

kvantour
  • 25,269
  • 4
  • 47
  • 72