2

! Duplicates questions 43733


Is there any validator for training purposes where you can enter cron syntax like

0 0/5 9-17 * *

and it will print out:

  • more detailed errors and suggestions
  • pronounced, readable text format (Option -h ;) )
    • e.g. "every 5 hours between 9th and 17th each month"
childno͡.de
  • 642
  • 1
  • 5
  • 14
  • 1
    Unless you're using a different version of cron than I am, that line does not represent "every 5 minutes between 9 and 17 o'clock every day". I guess that's *why* a readable text format output is required. :-) – Ladadadada Aug 15 '12 at 13:56
  • rofl, sorry, got confused while writing "crons" for jira: https://confluence.atlassian.com/x/gAISCw – childno͡.de Aug 15 '12 at 14:38
  • Possible duplicate of [Is there a way to validate /etc/crontab’s format?](http://serverfault.com/questions/43733/is-there-a-way-to-validate-etc-crontab-s-format) – childno͡.de Dec 06 '15 at 16:59

3 Answers3

4

You can use crontab -e which will open an editor allowing you to edit cron jobs. It will report errors in case you mistyped the cron job line.

Khaled
  • 36,533
  • 8
  • 72
  • 99
3

I highly recommend http://crontab.guru for this. Using your example above, it tells me:

“At every 0th minute past the 0, 5, 10, 15 and 20th hour on the 9, 10, 11, 12, 13, 14, 15, 16 and 17th of every month.”

It also give hints for each field you're editing as well as general cron tips with informative links for configuring cron on servers.

Hart Simha
  • 1,203
  • 8
  • 7
2

A command line tool that gives you a readable description of the cron expression is available at https://github.com/mrferos/hcron (implemented in JS for node.js). However, it doesn't do any validation or recommendations.