Why are cron.hourly files not running? SOLVED
Derek Broughton
news at pointerstop.ca
Tue Jul 17 15:54:49 UTC 2007
Larry Alkoff wrote:
> My cron.hourly file was not running because it was settime.cron
> and cron or anacron does not permit a period in the cron file name.
> The file is now called settime-cron and all is well.
Ack! I guess I've learned something, too.
>
> Larry Alkoff wrote:
>> Derek Broughton wrote:
>>> Larry Alkoff wrote:
>>>
>>
>>
>> Using your two commands.
>> sudo su of course changed to a root user.
>> The second line changed to the / directory but did nothing else AFAICS.
Precisely - so you would have seen _some_ output from that if anything were
being executed.
>> Before the command was issued the only thing I saw in /var/log/syslog
>> were entries of:
>> Jul 16 15:37:39 kinda smbd[12172]: Unable to open printcap file
>> /etc/printcap for read!
...
>> Whatever printcap has to do with I don't know.
Like it says - samba. You either don't _have_ a /etc/printcap or it doesn't
have permissions permitting the smbd daemon to read it. smbd starts as
root, but I expect (hope!) it drops permissions it doesn't
need. /etc/printcap should be world readable.
>
> A postscript:
>
> Tried logger with
> logger This is a test
> and indeed it wrote to syslog with a nice date/time stamp.
> I put it in my little settime.cron script.
>
> However, at the appointed minute of executing run-parts in
> /etc/cron.hourly, the settime.cron script with logger did not run.
>
> /usr/bin/logger is in the path that #!/bin/sh sets up.
>
> Again, I suspect that cron.hourly scripts are treated differently
> because the crontab line does not include anacron like the others.
crontabs specifically mention anacron to _exclude_ the jobs, not include
them. ie, in /etc/crontab:
test -x /usr/sbin/anacron || run-parts --report /etc/cron.daily
says, "if anacron DOESN'T exist, execute run-parts". If anacron exists, it
takes control of those tasks. It's assumed that cron.hourly jobs are going
to run soon, anyway, so no need to have anacron handle them.
(More correctly, what that crontab command does is shortcut a condition -
if "test -x" returns true, then run-parts is not executed).
Did:
# sudo su
# cd / && run-parts --report /etc/cron.hourly
actually do anything _this_ time?
--
derek
More information about the ubuntu-users
mailing list