Re: crontab jobs not running?
Nitebirdz <nitebirdz@sacredchaos.com> writes:
> On Tue, Mar 16, 2004 at 04:56:05PM +0100, Martin Dickopp wrote:
>>
>> You want to run `mkreport.deb' at 1:00am, and if the timezone in your
>> email header is correct, you appear to be 6 hours western of GMT. This
>> means that it is 1:00am GMT when it is 7:00pm of your local time. Therefore,
>> presumably something is wrong with your timezone configuration.
>>
>> - Is the environment variable `TZ' set? If so, to what? Is it already
>> set when cron is started?
>> - What's the content of /etc/timezone?
>> - What does /etc/localtime (a symlink) point to?
>>
>> You might need to run `tzconfig'.
>
> Thanks, Martin. Here is the information you are requesting. It all appears
> to be fine, except perhaps for the $TZ variable. Could that be causing the
> problem?
I don't think so; not setting TZ is fine. My thought was that if you set
TZ in a shell login script, it would be set in the shell where you ran
the `date' command, but not in the init script which starts `cron'. This
would have explained why `cron' and the shell use different timezones.
However, if TZ is /not/ set in the shell, the problem must be something
else.
> I will try running 'tzconfig' again, but that still doesn't explain
> why 'crontab -e' doesn't appear to be working at all, right?
Right. I have no idea why it doesn't.
Thinking about it, I have three ideas what you could check:
- Could it be that you have accidentally embedded an invisible control
character in the file?
- Is there a newline character after the last line?
- While you test `crontab -e', don't specify the next minute as time,
but one minute after the next (i.e. two minutes after the current
time). `cron' re-reads its crontabs once a minute, but only executes
newly found jobs in the /next/ minute.
BTW, does `crontab -e' work for users other than root?
> milan:~# echo $TZ
>
> milan:~# more /etc/timezone
> US/Central
>
> milan:~# ls -l /etc/localtime
> lrwxrwxrwx 1 root root 30 Mar 7 17:14 /etc/localtime -> /usr/share/zoneinfo/US/Central
That looks fine to me.
You already said that `date' shows the correct time. Does the command
`date -u' show the correct GMT time (i.e. six hours ahead of your local
time)?
If you run `date' and `date -u' as cron jobs, do they also show the
correct times?
Martin
--
,--. Martin Dickopp, Dresden, Germany ,= ,-_-. =.
/ ,- ) http://www.zero-based.org/ ((_/)o o(\_))
\ `-' `-'(. .)`-'
`-. Debian, a variant of the GNU operating system. \_/
Reply to: