

Cron commands to plain English - spncr2
http://www.cronchecker.net/

======
currysausage
_> the arcane syntax_

Arcane, seriously? What kind of syntax would be modern and clear in your
opinion? YAML? JSON? XML probably, with a nice 150-page _XTBJSPCOSDF
(Extensible Time-Based Job Scheduling for POSIX-Compatible Operating Systems
Description Framework)_ spec? ;)

Personally, I think this is pretty straightforward:

    
    
      #minute hour    mday    month   wday    command
      30      1       *       *       *       /bin/sh /etc/daily
      30      3       *       *       6       /bin/sh /etc/weekly
      30      5       1       *       *       /bin/sh /etc/monthly

------
sprobertson
I'd dig something going in the opposite direction! Especially packed in a
shell script, e.g. `cronglish "echo testing" every half hour >> ~/.crontab`

------
ColinWright
OK, so I gave it this:

    
    
        8-59/30 * * * * do_something
    

It replied:

    
    
        The command do_something will execute
        the 8th through 59/30th minutes of
        every hour every day.
    

That's a pretty poor description of something that will run at 8 and 38
minutes past the hour, every hour of every day.

Not impressed - seems overly simplistic.

~~~
pbyrne
> Not impressed - seems overly simplistic.

Agreed that it's not impressive, beings that the explanation is simply wrong.
It's an edge case I'm definitely not handling properly. I've got [an open
issue]([https://github.com/pbyrne/cron-
checker/issues/7](https://github.com/pbyrne/cron-checker/issues/7)) about
combining ranges and modulo, but haven't gotten around to implementing it yet.
Displaying an incorrect explanation is probably worse than no explanation,
though, in retrospect.

~~~
ColinWright
The challenge is to decide what you would want it to say in the case of, say,
"14-59/15". Do you want it to list all the possibilities? That becomes tedious
if you have something like 2-57/2\. Do you want to try to create a more direct
plain English parse?

    
    
        14-59/15 - Every 15th minute starting with the 14th
                   up to and including the 59th.
    
         2-57/2  - Every 2nd minutes starting with the 2nd
                   up to and including the 56th.
    

A choice needs to be made - the direct plain English parse is quite long, and
not always easy to read.

------
thomseddon
I built the opposite version of this, convert plain English to cron commands:
[http://thomseddon.github.io/cronstring](http://thomseddon.github.io/cronstring)

~~~
ushi
Awesome, now you have a test suite

    
    
        assert(cronchecker(cronstring(input)) == input)

------
iwalton3
You can also use DuckDuckGo to do this:
[https://duckduckgo.com/?q=cron+0+0+*+*+*+some_report.sh&t=lm](https://duckduckgo.com/?q=cron+0+0+*+*+*+some_report.sh&t=lm)

~~~
timdiggerm
>Cron will schedule the job at this frequency: 0:00:00 on 2 Aug, 2014 0:00:00
on 3 Aug, 2014 0:00:00 on 4 Aug, 2014

Results are a little harder to read. This other site gives more natural
sentences.

------
mike-cardwell
Does not understand this syntax: "1-56/5 * * * * foo"

~~~
ajmurmann
What does that do?

CronWTF doesn't understand it either and that one even has a cat!

~~~
riquito
> 1-56/5 * * * * foo

The first minute of the hour, then every 5 minutes until the 56th minute,
inclusive

------
geekrax
Just played a bit with it. [http://goo.gl/q8lT9B](http://goo.gl/q8lT9B)

------
budu3
Looks like they're the chaps behind
[https://deadmanssnitch.com](https://deadmanssnitch.com) which looks like a
simple and useful service.

~~~
pbyrne
Hi there. Popping in to clarify that the (excellent) folks behind Dead Man's
Snitch are advertising on the site, but that otherwise I'm not affiliated with
them and they haven't contributed to the project beyond the ad.

That said, it's a pretty great product and you should check them out!

------
ddlatham
It would be great to also list the next few datetimes that this would occur on
as examples.

It would also be great to support the seconds field.

~~~
ColinWright
I believe cron does not have a seconds field:

From "man 5 crontab":

    
    
        cron(8) examines cron entries once every minute.
        The time and date fields are:
    
                  field          allowed values
                  -----          --------------
                  minute         0-59
                  hour           0-23
                  day of month   1-31
                  month          1-12 (or names, see below)
                  day of week    0-7 (0 or 7 is Sun, or use names)
    
        A field may be an asterisk (*), which always stands
        for "first-last".
    
        Ranges  of  numbers  are allowed.  Ranges are two
        numbers separated with a hyphen.  The specified
        range is inclusive.
    
        For example, 8-11 for an "hours" entry specifies
        execution at hours 8, 9, 10 and 11.
    
        Lists are allowed.  A list is a set of numbers (or
        ranges) separated by commas.  Examples: "1,2,5,9",
        "0-4,8-12".

~~~
ddlatham
_In some uses of the CRON format there is also a seconds field at the
beginning of the pattern. In that case, the CRON expression is a string
comprising 6 or 7 fields._

[http://en.wikipedia.org/wiki/Cron#Format](http://en.wikipedia.org/wiki/Cron#Format)

------
jchavannes
For visualizing a large quantity of crons, I'd recommend something akin to
[https://github.com/federatedmedia/cronviz](https://github.com/federatedmedia/cronviz)
which will graphically show when jobs are scheduled to run.

------
_kst_
@reboot cd ~/bin/some_daemon

is not a very good example. It will launch a shell which will change to the
specified directory and then terminate. (It might produce an error message if
the directory doesn't exist.)

------
pwenzel
This is nice.

I also turn to [http://cronwtf.github.io](http://cronwtf.github.io) when I
need to sanity-check my crontab, which is a little more verbose and includes
JSSpec tests.

------
gav
Also see crontab2english:
[http://interglacial.com/pub/crontab2english.html](http://interglacial.com/pub/crontab2english.html)

------
LiveTheDream
I've been using [http://cronwtf.github.io/](http://cronwtf.github.io/) for
years to double-check cron expressions.

------
callesgg
Not bad, each line in my cron has somthing lke that next to it :)

