
Cron checker - otoolep
http://crontab.guru/
======
Animats
This is why the UNIX approach of using flat text files for dynamic information
is obsolete. It seems so simple to have a text file. But then you need an
editor, a locking system, access control, and a checker. And probably
something to remove orphaned lock files and detect corrupted data.

Those are all database functions. In UNIX/Linux, each configuration file has
its own mechanism for all that. They're all inferior to SQLite.

~~~
scrollaway
Can someone explain to me how crontabs, and cron syntax, are still so popular
and one of very few options available?

It's not like crontabs are written all the time. They don't need to be so
terse. They shouldn't require learning a language... they shouldn't require a
cron.guru website. Systemd timer syntax
([https://wiki.archlinux.org/index.php/Systemd/Timers#Example](https://wiki.archlinux.org/index.php/Systemd/Timers#Example))
is far more readable, and there's still a lot of room for improvement.

~~~
audleman
Sure. Spend a focused 10 minutes to really try and understand them and you'll
realize that a cron line is a perfectly concise and flexible syntax for
creating scheduled time events. It even handles that crazy case where you want
to run on a specific day of the week. Cron lines may seem arcane at first, but
then again have you ever tried to write code that was timezone aware? Welcome
to a special kind of hell. What I'm trying to say is there's complexity there
and you'll be a better programmer if you embrace it.

Unix programmers aren't in the habit of throwing out a working system because
it's hard to grok, nor building something more complex then it needs to be. I
took a look at your systemd timers link and it is a more complex syntax to
create the same effect. From their own caveats section:

> Complexity: to set up a timed job with systemd you create two files and run
> a couple systemctl commands. Compare that to adding a single line to a
> crontab.

~~~
scrollaway
> Spend a focused 10 minutes to really try and understand them

I've spent the past years doing that. I do understand cron. I also _strongly_
dislike it. You could build a thriving city within the bounds of the room
there is for improvement.

> It even handles that crazy case where you want to run on a specific day of
> the week.

So does systemd's cron. Supporting "crazy cases" doesn't mean the syntax has
to suck.

> Cron lines may seem arcane at first, but then again have you ever tried to
> write code that was timezone aware?

Yes...

Re systemd: It's one example; it's not perfect, I wouldn't even call it good,
but it's leagues ahead of cron in terms of UX already. Bonus: usage of the ini
format means it's programmatically much easier to interact with the cronjob
itself.

~~~
koytch
It's ugly, simple and flexible. I can live with its ugliness (I don't change
my crontab every day, after all) and simplicity and flexibility beat ini
format/UX/etc. any time AFAIC.

~~~
berntb
My main problem with the cron syntax is that is error prone. I'd like it to be
a bit harder to get correct syntax when you write something wrong.

But a simple GUI could take care of that.

~~~
bpchaps
Something curses based would be nice - no need for a GUI ;). Cron's syntax can
be hellish. For example, % is treated as a special newline character (ugh) so
that commands like this don't work - and it's very difficult to troubleshoot:

    
    
      appstartup.sh | tee -a app.`date +%Y%m%d`.log

------
joelthelion
What I'd like is a way to check that the _command_ will run properly. Waiting
for one minute to test is not productive at all. And no, testing in your shell
won't do, since cron runs in a particular environment.

~~~
chrisan
> And no, testing in your shell won't do, since cron runs in a particular
> environment.

Have you tried any of these answers?

[http://stackoverflow.com/questions/2135478/how-to-
simulate-t...](http://stackoverflow.com/questions/2135478/how-to-simulate-the-
environment-cron-executes-a-script-with)

~~~
cmiles74
Running a cron job that writes out it's environment and then running the job
I'm testing in that environment has always worked pretty well for me. A
hassle, but I've had good luck.

~~~
therein
I was about to suggest the same. Just have your cronjob dump its environment
for you so that you can simulate it more accurately.

------
ajmurmann
Looks like a more polished version of
[https://cronwtf.github.io](https://cronwtf.github.io) minus the awesome name
and cat picture

~~~
faaabio1618
But more correct:

cronwtf:

0 0 1 1 0 COMMAND Runs `COMMAND` at minute :00, on hour 0, on day 1, in Feb,
on Sun.<\-- NO!

crontab:

0 0 1 1 0 At 00:00 on the 1st and every Sun in Jan. <\-- CORRECT

------
thomseddon
Looks great! I also find the other way around very convenient:
[http://thomseddon.github.io/cronstring/](http://thomseddon.github.io/cronstring/)

------
taspeotis

        5 4 W * *
    

Really gave Chrome some grief.

~~~
0xmohit
> 5 4 W * *

> Really gave Chrome some grief.

You are evil.

It also gave Firefox a lot of grief. CPU usage shot to 100%.

~~~
Bromskloss
Pff. My Firefox CPU usage is always at 100%.

~~~
ComodoHacker
Buggy addon perhaps?

------
0xmohit
Crontab generator [0] is a good alternative that doesn't feature broken JS
[1]. Moreover, the example and configuration page on the wikipedia page [2]
are clear enough.

[0] [http://crontab-generator.org/](http://crontab-generator.org/)

[1]
[https://news.ycombinator.com/item?id=12105516](https://news.ycombinator.com/item?id=12105516)

[2] [https://en.wikipedia.org/wiki/Cron](https://en.wikipedia.org/wiki/Cron)

------
unchaotic
Some other random ones that I've used in the past :

[http://www.cronmaker.com/](http://www.cronmaker.com/)

[http://crontab-generator.org/](http://crontab-generator.org/)

[http://www.openjs.com/scripts/jslibrary/demos/crontab.php](http://www.openjs.com/scripts/jslibrary/demos/crontab.php)

[http://htmlminifiers.com/cron-maker.php](http://htmlminifiers.com/cron-
maker.php)

[http://cron.nmonitoring.com/cron-
generator.html](http://cron.nmonitoring.com/cron-generator.html)

[https://crontranslator.appspot.com/](https://crontranslator.appspot.com/)

[http://cron.schlitt.info/](http://cron.schlitt.info/)

------
agumonkey
I leaerned more with one minute of this than all previous attempts at rtfm
since 2002. Kudos

[http://crontab.guru/#*_5/6_*_*_*](http://crontab.guru/#*_5/6_*_*_*)

~~~
webreac
As a non english native, the man page of cron is far more complete and easy to
read than many other pages (find, tar, bash, ...)

~~~
agumonkey
Fair enough, in my case I really couldn't skim and parse it.

------
krzrak
"15 14 1/2 2 *" -> “At 14:15 on the 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23,
25, 27, 29 and 31st in Feb.” :)

------
lugus35
It would be nice to have the inverse: write in plain english what you want and
it gives you the crontab line.

------
Pamar
Hopefully this will attract lots of _cron_ experts. _systemd_ experts are fine
too... I have a question for you all:
[https://news.ycombinator.com/item?id=12084455](https://news.ycombinator.com/item?id=12084455)

------
krick
Why just not replace cron with something a bit more flexible in terms of
settings and config formats? Seriously, I guess time spent on making this
website should be coparable with rewriting cron — it's not like cron is a
complicated piece of software.

~~~
michaelmrose
We await your efforts. Please detail the advantages your system will have over
existing cron implementations and put up a kickstarter.

------
fideloper
Can anyone find (confirm) flaws in it? For example, this gives me the same
result for

    
    
        0/5 * * * *
    

as it does for

    
    
        */5 * * * *

------
gourneau
This is a super great tool.

If any of y'all are looking for a more modern cron replacement for running
periodic tasks with a nice web uis here are a few other options:

* Rundeck [http://rundeck.org/](http://rundeck.org/) * Stackstorm [https://docs.stackstorm.com](https://docs.stackstorm.com) * ndscheduler [https://github.com/Nextdoor/ndscheduler](https://github.com/Nextdoor/ndscheduler)

------
CraigJPerry
Heh it even models the weird behavior you get when you specify day of month
AND day of week.

All other fields are AND together, these two are OR

------
boot13
I love this. Thank you.

------
mangix
who uses cron when you have systemd anyway?

~~~
int0x80
So, obviously systemd has also taken over crontab? My god ... Really this is
sick. I've to fight systemd to do some dead simple init.d custom services and
it was awful. Even the process resource limits had to be setup in the sytemd
config files.

I like /etc/crontab. It is a simple text file. Nothing magic. Standard. Works
every time. Well known by everybody. Works on a lot of UNIXes, old Linux
systems etc.

I don't want no new complexity and a new way to do things every 6 months. What
I hate most is that all this is pushed through our throats no matter what we
want. FFS.

EDIT: BTW, I think luckily, /etc/crontab at least currently still works on
Ubuntu Server 16.04 (what I've tried). I think this is the way to go. If you
want to use some new features (systemd) you can opt-in. But don't break old
stuff please.

~~~
klapinat0r
Care to give an example? What I'd call "dead simple init.d custom services" I
find very easy to do in systemd, so I wonder if our definition is the same.

Here's what I'd call a simple init.d-like example. non-needed things (if you
think it's too complex) include: wait for fs mount and network, custom reload
command, "don't log stdout"

    
    
      [Unit]
      After=network.target
      AssertPathIsMountPoint=/mnt/service-data-if-needed
    
      [Service]
      ExecStart=/some/binary
      Environment=CONF=/etc/i/guess.conf USER=nonrootmaybe
      ExecReload=/bin/pkill binary
      KillMode=process
      Restart=always
      StandardOutput=null
    
      [Install]
      WantedBy=multi-user.target
    

EDIT: _man 5 systemd.unit_

~~~
dingaling
> After=network.target

That only guarantees that your network devices have been enumerated, not that
they are available with assigned addresses.

I encountered this problem with SSH failing to start on Ubuntu 16.04 server.
systemd was launching SSH before the binding address had been assigned,
causing SSH to abort and fail and the server to continue to boot without any
way of accessing it remotely.

Workaround ( at the physical console ) was to add a Retry to the SSH unit and
time it to coincide with the address having been assigned[0]. hacky, but no
other unit imperatives worked.

[0] Default behaviour in the SSH unit, at least on Ubuntu, is that it tries
once and never again.

~~~
digi_owl
And here i thought systemd was about getting rid of those waits.

Also, i expect the faithful to come and claim it is a Canonical fuckup.

------
yoavm
what about @reboot ?

~~~
kseistrup
Read tip number 5:
[http://crontab.guru/tips.html](http://crontab.guru/tips.html)

