[LRUG] Disrespectful cron

Andrew Stewart boss at airbladesoftware.com
Tue Feb 13 10:45:57 PST 2007


On 13 Feb 2007, at 16:41, Dominic Mitchell wrote:

> If that's a log file, you probably want to say:
>
>   /usr/bin/ruby /home/deploy/cron_test.rb >> /home/deploy/cron.log
>
> Otherwise each run will wipe out the previous file.

Excellent point.  However, in this case, I don't mind what's actually  
in the output -- I was just looking for some output to be generated  
to determine whether or not cron was running my job.

I assume cron uses the server's time as revealed by the date  
command.  The server's on EST but I can't see how the timezone would  
affect things.


> here's normally a log in /var/log/cron.log saying what cron is
> attempting to do.  Have a look in there.

Here are the last few entries:

Feb 13 10:40:31 andy crontab[781]: (deploy) LIST (deploy)
Feb 13 10:42:32 andy crontab[799]: (deploy) LIST (deploy)
Feb 13 11:00:36 andy crontab[923]: (deploy) LIST (deploy)
Feb 13 11:01:02 andy crond[932]: (root) CMD (run-parts /etc/cron.hourly)
Feb 13 12:01:02 andy crond[1200]: (root) CMD (run-parts /etc/ 
cron.hourly)
Feb 13 13:01:01 andy crond[1454]: (root) CMD (run-parts /etc/ 
cron.hourly)
Feb 13 13:32:49 andy crontab[1631]: (deploy) BEGIN EDIT (deploy)
Feb 13 13:32:58 andy crontab[1631]: (deploy) END EDIT (deploy)
Feb 13 13:34:00 andy crontab[1660]: (deploy) BEGIN EDIT (deploy)
Feb 13 13:34:12 andy crontab[1660]: (deploy) REPLACE (deploy)
Feb 13 13:34:12 andy crontab[1660]: (deploy) END EDIT (deploy)
Feb 13 13:34:18 andy crontab[1664]: (deploy) BEGIN EDIT (deploy)
Feb 13 13:34:24 andy crontab[1664]: (deploy) REPLACE (deploy)
Feb 13 13:34:24 andy crontab[1664]: (deploy) END EDIT (deploy)
Feb 13 13:35:01 andy crond[32229]: (deploy) RELOAD (cron/deploy)

You can see me editing and listing the crontab.  I can't see anything  
that looks out of the ordinary to me....


> Another thing to try is inserting a line in your crontab like this one
> so you get mailed any output.
>
>   MAILTO=me at some.where

I tried deploy at localhost and deploy but neither yielded any mail.


> One last tip -- get rid of any blank lines in the crontab.  They've
> caused me trouble in the past.

Good tip.  I checked but there weren't any.  I then added in a blank  
line (I would have kicked myself if that had fixed it) but it didn't  
make it work.

Thanks for the good ideas...do you have any more? :)

Regards,
Andy



More information about the Chat mailing list