Cron Conundrum

5 posts / 0 new
Last post
#1 Mon, 03/16/2009 - 13:24
katir

Cron Conundrum

I have a puzzle: We have a daily rss feed that pulls together static files and builds a new *rss-feed.xml file daily adds a new item to the feed. Feedblitz pulls this, checks for a new item and emails a list. I have the cgi that does the job set to run on a cron, from with in WebMaster > Scheduled Cron jobs. In the GUI we have set "Selected Times below" I have set minutes to 10; hours to 0; months ALL; days ALL.

Now, it's my understanding that this should fire at 12:10 am, 10 Minutes after midnight. but, the mod/date on the *rss-feed.xml file is 13:48!

Any clues? It was firing on time (I think) until a few days ago, but now it is not... I'm not sure what to do. Is it possible for the cron tab to be corrupted?

Mon, 03/16/2009 - 13:55
andreychek

Well, first odd, I'd suggest running the "date" command on your server to make sure the system date is set correct :-)

Also, you should see all the cron tabs in /var/spool/cron/crontabs. If you look in there for the one you added, can you paste the entry in here? Then we can help debug it and make sure it's doing what it should be.

Also, the logfiles in /var/log show when cron does stuff. On Ubuntu in particular, I know it uses /var/log/syslog.

You can use that to figure out when it's firing off cron entries. Also, if you restart cron and look in the logs, if there's any kind of syntax error, that would show up.
-Eric

Mon, 03/16/2009 - 17:08 (Reply to #2)
katir

OK good suggestions, Here's the entry clearly poked by the WebMin GUI:

10 0 * * * /home/himalayan/cgi-bin/daily_mclesson_rss.cgi #builds rss for Master Course lesson of the day.

this used to run 10 minutes after midnite, isn't that correct?

All my other "Dailies" are set to

@daily

Note, the problem *did* happen on March 8th... so possibly there is a DST issue...but why a DST roll over would make the cron fire 13 hours:38 minute late is mysterious.

OK, date is looking good:

Mon Mar 16 18:38:14 PDT 2009

and this is 3 hours ahead my own HST so it means that DST kicked in somehow on the box, even though I didn't actually do anything to evoke DST..

and cat var/log/cron has an entries for

Mar 15 00:10:01 sat crond[19202]: (himalayan) CMD (/home/himalayan/cgi-bin/daily_mclesson_rss.cgi #builds rss for Master Course lesson of the day.)
Mar 16 00:10:01 sat crond[11589]: (himalayan) CMD (/home/himalayan/cgi-bin/daily_mclesson_rss.cgi #builds rss for Master Course lesson of the day.)

So, yes, it appears that it is firing as expected... but this CGI writes to disk. I can also manually fire the cgi and it write to disk just fine and I get the right creation time... I have just now fired the cgi and the mod time on the file is as expected... 19:01 one minute after 7 PM in California... OK, now I will just have to wait and watch and see what the mod date is tomorrow. But there are no errors appearing in any logs

Mon, 03/16/2009 - 17:26 (Reply to #3)
andreychek

Well, it sounded like the initial reason for your concern was when you saw an odd time on the file it wrote to.

Is it possible someone hit from the web, rather than from a cron job?

You could try grepping the apache access log for "daily_mclesson_rss.cgi" on the day of the strange timestamp that you saw.

Otherwise, yeah, I'm not sure -- everything you said above sounds good, the cron job is running at the expected time, and so forth.
-Eric

Mon, 03/16/2009 - 17:29 (Reply to #4)
katir

Yes, it is possible someone hit it from the web. I'll check tomorrow evening at 9:15 HST... and if the file was written to disk then (12:15 PST) then we know it's work and that yes, somehow the CGI got pinged... which is not a big deal as it doesnt' really affect anything. But I will check the access logs, good idea.

Topic locked