from Hacker News

Cron commands to plain English

by spncr2 on 8/1/14, 6:50 PM with 26 comments

  • by currysausage on 8/2/14, 2:09 PM

    > 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
  • by sprobertson on 8/1/14, 8:49 PM

    I'd dig something going in the opposite direction! Especially packed in a shell script, e.g. `cronglish "echo testing" every half hour >> ~/.crontab`
  • by ColinWright on 8/2/14, 10:22 AM

    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.

  • by thomseddon on 8/1/14, 11:15 PM

    I built the opposite version of this, convert plain English to cron commands: http://thomseddon.github.io/cronstring
  • by iwalton3 on 8/1/14, 7:55 PM

    You can also use DuckDuckGo to do this: https://duckduckgo.com/?q=cron+0+0+*+*+*+some_report.sh&t=lm
  • by mike-cardwell on 8/1/14, 8:31 PM

    Does not understand this syntax: "1-56/5 * * * * foo"
  • by geekrax on 8/1/14, 8:11 PM

    Just played a bit with it. http://goo.gl/q8lT9B
  • by budu3 on 8/1/14, 8:56 PM

    Looks like they're the chaps behind https://deadmanssnitch.com which looks like a simple and useful service.
  • by ddlatham on 8/1/14, 9:36 PM

    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.

  • by jchavannes on 8/1/14, 11:07 PM

    For visualizing a large quantity of crons, I'd recommend something akin to https://github.com/federatedmedia/cronviz which will graphically show when jobs are scheduled to run.
  • by _kst_ on 8/1/14, 9:35 PM

    @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.)

  • by pwenzel on 8/1/14, 9:43 PM

    This is nice.

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

  • by gav on 8/1/14, 10:28 PM

  • by LiveTheDream on 8/1/14, 9:42 PM

    I've been using http://cronwtf.github.io/ for years to double-check cron expressions.
  • by callesgg on 8/1/14, 9:43 PM

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