20 comments

[ 3.2 ms ] story [ 53.0 ms ] thread
Maybe an example of what you consider a valid cron expression would help. Pasted things straight out of crontab, with and without the command part, and it says "invalid cron expression" for all of them.

Edit: Apparently, you're being strict about only a single space between fields, and not including the command part.

It apparently just wants the timing information, and will print a readable schedule based on that. Try

  0 */2 * * *
By the way, this app sorely needs a link-to-result functionality.
My crontab had extra spaces and/or tabs between fields, which crontab(5) is fine with. This app wants only a single space between fields.
@reboot is not valid :(
Also, anything with "/0" gives a divide by zero exception:

for example:

  */0 * * * *
What does that even mean? Never used that one...
There are quite a few of these about on the internet, they make a nice little pet project if you're trying to pick up a language or methodology.

Full disclaimer: I made one as a toy a while ago (http://whenwillcronfire.jordanrobinson.co.uk/) but never really did anything with it.

Indeed, I find this one much more useful and use it often. It gives you a compact description of the expression in words, e.g.:

  “At every 5th minute.”
  “At 03:20 on Sunday.”
  “At every 10th minute past hour 3 and 4.”
I’ve long wanted API access to a system’s cron “smarts”. Like I sort of wish /usr/sbin/cron was a “dumb shell” around a hypothetical "/usr/lib/libcron.so", so that I could write programs that could just get the exact right answer (about timing, syntax, etc.) without having to guess. Does that exist?
I think systemd timers may provide something like that but everyone seems to be against systemd because it tries to do things correctly. Shonky text-based configuration files and fragile integration is clearly better.
> against systemd because it tries to do things correctly.

There are good sides to systemd, and bad sides. Pretending the issue is one-sided like this is naive at best.

Also, cron supports 6 asterisk for running cron jobs down to a second.
Uhm... No? Depends on what cron implementation you use, but neither Vixie cron nor dcron support that, and it's not mentioned in SUS.
https://github.com/alpaker/cronviz is a graphic visualizer of a whole crontab, and it runs locally so you don't need to offer your info to a random website.

(I'm not associated with it in any way; I just had a need for it a few weeks ago.)

> it runs locally so you don't need to offer your info to a random website

Odd reasoning for this specific instance. The only thing to offer the website is a cron expression. Without any context, how sensitive is that information?

Context makes it much more valuable. If you only had one cron expression, you would just figure it out by yourself. The interesting things happen when you've got fifty cron jobs running on six boxes (or five thousand on six hundred) and you want to see when things get slammed. Having the name of the job associated with the colorful blips is important.
This broke the back button.
Predictor? Isn't it definitive?
crashed your site, got the following error- " Fatal error: Maximum execution time of 30 seconds exceeded in /home/cronjob/public_html/application/models/Cron/AbstractField.php on line 97 " Sanitize the inputs. I used this invalid expression - * 5/* * *