the hayley

Ever start a blog entry and then forget to finish it? Surely, that's not me and not this one!

So yeah, I started using whenever and I was going to blog on the whys, but then I forgot to finish the post. So instead here, you'll get a recap of what I think were the reasons and how I think I set it up.

why use whenever to manage your crontab

Even if you're a seasoned *nix veteran, the cron syntax can often be quite head scratching. whenever lets you write cron job rules in code that makes actual sense.

Cyclocane was the first project that I decided to use whenever on. wickedwx is using the old method. Namely, I've got a crontab.txt file in my project's git repository with actual cron syntax.

Here's some of my brilliance:

0,5,10,15,20,25,30,35,40,45,50,55 * * * * <do some awesome sh*t here>

The whenever equivalent?

every 5.minutes do
        <do awesome shizzle here>

Which one would you rather read?

Here's an example off of wikipedia:

0 */2 * * *  /home/username/

WTF does this do? I sure wouldn't have known, but this line will make this script run "every two hours, namely at midnight, 2am, 4am, 6am, 8am, and so on".

The whenever equivalent to 0 */2 * * * is every 2.hours. So much nicer.


Normally, here I might throw in an example of how you'd get this project set up, but it's been weeks for me at this point, so instead I'll just say that, if you're interested, read the documentation on whenever's github page.

the hayley