Stuart Jones
Chrono, the Cron-to-English Cron Job Builder

Cron is a popular reoccurring task scheduler for Unix-based computer systems. The concept is relatively simple: Create a .crontab file with your scheduled events, and an omnipresent system daemon executes the command at the correct time. Cron has been around since the 1970s, so the crontab's file format has seen plenty of use outside of Cron itself. Being such an old format, Cron can take a while to completely wrap your head around. Set your brackets and braces aside, Cron works completely off of whitespace and newline characters.

Here's an example of your typical .crontab file:

30 08 10 06 * /home/john/full-backup
00 11,16 * * * /home/john/bin/incremental-backup
00 09-18 * * * /home/jane/check-db-status

The first five entries designate the times the job should run, and the last entry is the command that should be run. Cron's manfile gives a brief rundown of what which number signifies:

# ┌───────────── minute (0 - 59)
# │ ┌───────────── hour (0 - 23)
# │ │ ┌───────────── day of month (1 - 31)
# │ │ │ ┌───────────── month (1 - 12)
# │ │ │ │ ┌───────────── day of week (0 - 6) (Sunday to Saturday;
# │ │ │ │ │                                       7 is also Sunday on some systems)
# │ │ │ │ │
# │ │ │ │ │
# * * * * *  command to execute

In addition to numbers, Cron also accepts * wildcards, and will also allow ranges of values (1-5) and comma separated lists of values (1,3,6,8).

Some cron jobs are easier to build than others. It's fairly easy to determine that 0 0 * * * means midnight every night, but it's less evident that 0 0 * 1 0 means midnight on every Monday in January. To double-check their work, programmers often turn to Cron-to-English tools to ensure their task will run at the correct interval.

I've been learning React recently, and realized that a such a converter would be a nice way to test the React skills I had learned without needing to code an extensive backend. The end result was Chrono, a simple Cron-to-English Cron Job Builder.

Chrono takes a standard 5 field Cron job, validates the entries, and then converts it to English. It also provides a field-by-field explanation of valid values. It can be used in the embed above, or viewed directly using the link.

Building Chrono was relatively straightforward. It uses the latest version of React (15.3), and the ES2015 and JSX javascript standards. I used the Gulp task runner to convert the ES2015 scripts to standard ES5 javascript using the Babel polyfill. For styling the page, I used the Bootstrap framework and the Sass CSS Preprocessor. For converting the cron jobs to plain English, I used azza-bazoo's PrettyCron NPM package. This package was converted for use with React by Browserify. Finally, the validation of the various cron fields was done by this lengthy RegEx. The code for Chrono can be found on my Github repository.