Cron schedule from 7:15am to 8:30pm at every minute

I can't find any material on how to create hours with minute components within a single expression.

1 Answer

There is no way to run this particular cron job in just a single expression, but it could be done in three:

15-59 7 * * * echo "This command runs every minute from 7:15am to 7:59am"
0-59 8-19 * * * echo "This command runs every minute from 8:00am to 7:59pm"
0-30 20 * * * echo "This command runs every minute from 8:00pm to 8:30pm"

POSIX cron allows you to use dashes (-) to define a range of units (0-59), or commas (,) to define a list of units (0,2,4,6,8). Some cron variants also allow using slashes (/) to define evenly recursing units (*/15 is the same as 0,15,30,45).

Unfortunately, none of those work when you have an unusual beginning and end like your example does.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like