That's a bad title, it really should be "stupid cron mistakes" or "when idiots set up cron jobs, tonight on Fox!" or maybe "I'm Polish, but really, I'm not blonde".
Last week I set up a cron job to email our VP of engineering with some information on the first of every month. I've done cron jobs hundreds, nah, thousands of times, how hard can this be? It wasn't.. really.. piece of cake..
* * 1 * * mail important_boss_person@tickets.com
No problem.. that is, until this morning as I get an email requesting the damn flood of emails stop. Thank god the first wasn't on a weekend..
--- Added later ---
I've been asked by the less-cron-literate to explain what in the world is funny about this. It's like this, see.. in the cron world, there are 5 basic ways to describe when a job should fire off.. They live on one line, in the form of numbers, separated by a space.
Let's pretend these things below are numbers not the friendly, descriptive words they realy are.
Minute Hour Day-of-Month Month Day-of-Week
That's the most simplistic view, there are some very complicated and confusing ways of using all this, but for the purposes of illustrating my blonded-ness (is that a word?) this will suffice. For a wildcard (at any possible-value for this column) you'd use, of course an asterisk (*). So say, if I want something to run on the 1st of every month, at a quarter after 3, i would do something like...
15 3 1 * * Run-little-cron-run
As opposed, to say, if I wanted something to run every minute of every hour on the first of the month.. then i would use, eh, you see it above.
TrackBack URL for this entry: http://www.unix-girl.com/mt/mt-tb.cgi/1239
"Why is Trapszo sending out so many mails?"
"Don't know boss, what do they say?"
"Remember to type dmesg you nuthead!
- ktrapszo"
#Mmmm... *nostalgia* I remember this. Quite a few e-mails were returned after the hard drive became filled with letters about how my cron job was causing errors... every 60 seconds for a couple of weeks.
#I've found that crontab2english can save the day:
http://www.cpan.org/authors/id/S/SB/SBURKE/crontab2english_0.71.pl
My favorite stupid cron mistake is due to (IMO) a stupid design decision in cron. 'crontab -e' edits your crontab file. 'crontab -r' REMOVES your crontab file (without so much as a 'hey, are you really sure you want to do something so stupid?'). And of course, 'e' and 'r' are right next to each other on the keyboard.....
Oh well, that's what backups are for.
#After reading Kasia's mishap with a cron script, I laughed at her rookie mistake. And then I looked at my...
(read more)
June 2, 2004 03:13 PM