moving cron expressions up the taxonomy

https://cron-trigger.netlify.app/

https://github.com/lpmi-13/cron-trigger

So cron expressions are a basic aspect of linux computing, and you’ll see them in all the major public cloud providers (AWS/Azure/GCP) for running things on a schedule. They’re useful to know, and once you’ve actually used them, they’re fairly straightforward.

Well…AWS and Azure both use special syntaxes that are non-standard, but I decided not to deal with them here, in favor of just focusing on the key elements of the standard cron.

Minute / Hour / Day-of-the-Month / Month / Day-of-the-Week

You might suspect that there are a multitude of resources online that explain the syntax as well as give you examples of different configurations…and you would be right.

What does NOT (to my knowledge) exist anywhere is a place where you can actually attempt to write a cron based on some desired schedule (eg, once an hour every Tuesday) and get feedback on whether you actually did it correctly.

Similarly, getting practice reading a cron expression (eg, * 15 * 5 *), complete with feedback as to whether you can accurately turn that into a schedule (here, “run this at 3PM every day in May”) is nowhere to be found.

Until now!

Enter the newest micromaterial, cron-trigger!

create an appropriate cron expression for a given schedule

It’s a super simple micromaterial with only two modes: write a cron & read a cron. Here, all you have to do is re-arrange the elements of the expression until it means the same as the phrase “every minute after every hour every saturday in February (ie, * * * 2 6). Once you have it in the correct order, the screen lets you know and you can move to the next exercise.

practice reading a cron and interpreting it

In the second mode, all you have to do is select the correct schedule (in human people words) that means the same thing as the corresponding cron expression (ie, “at 2 minutes after 9AM every wednesday”).

I had to cheat here and make these less authentic than they otherwise would be, since values up to 59 are valid as minutes, and anything over 31 can only be minutes, so anytime you see something between 32-59, you can use deductive reasoning to figure out the correct answer…not necessarily your understanding of cron syntax.

There’s even a simple help screen if you need a reminder about which value goes where…

tips if you forget

The algorithm to create distractors and their corresponding phrases is also very rough, and could definitely be optimized significantly, but a finished product is out the door, so I’ll probably just leave it.

What I like about this is that you don’t just need to KNOW or UNDERSTAND cron syntax, you need to actually APPLY that knowledge in either reading a schedule and turning it into a cron or reading a cron and turning it into a schedule.

So in terms of learning outcomes that it assesses, it’s probably the most advanced material in existence. No big deal.

One thought on “moving cron expressions up the taxonomy

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s