cron jobs not running - Redhat
This is a discussion on cron jobs not running - Redhat ; On RedHat 8.0, if I am testing a background shell script to be run by cron,
I can do add an entry in crontab, via 'crontab -e', with the minute field
set to a couple of minutes in advance of ...
-
cron jobs not running
On RedHat 8.0, if I am testing a background shell script to be run by cron,
I can do add an entry in crontab, via 'crontab -e', with the minute field
set to a couple of minutes in advance of current time. It seems these jobs
will not run, with absolutely no entry/explanation in email or
/var/log/cron. If I edit the same crontab line and put a "*" for every
minute, it runs fine.
Say it is now 17:30, if I enter crontab line
34 17 * * * /usr/local/bin/myscript
Then wait until time is 17:40 and nothing happens. If I change it to read
* 17 * * * /usr/local/bin/myscript
It works fine. Is there something I am missing?
-
Re: cron jobs not running
On Sun, 29 Feb 2004 17:43:10 -0800, Bob Meyers thoughtfully wrote:
> On RedHat 8.0, if I am testing a background shell script to be run by cron,
> I can do add an entry in crontab, via 'crontab -e', with the minute field
> set to a couple of minutes in advance of current time. It seems these jobs
> will not run, with absolutely no entry/explanation in email or
> /var/log/cron. If I edit the same crontab line and put a "*" for every
> minute, it runs fine.
>
> Say it is now 17:30, if I enter crontab line
>
> 34 17 * * * /usr/local/bin/myscript
>
> Then wait until time is 17:40 and nothing happens. If I change it to read
>
> * 17 * * * /usr/local/bin/myscript
>
> It works fine. Is there something I am missing?
Any messages in /var/log/cron ?
Mar 1 04:00:00 enterprise CROND[14625]: (root) CMD (/home/noi/programs/chkrootkit.sh)
Mar 1 04:01:01 enterprise CROND[15529]: (root) CMD (run-parts /etc/cron.hourly)
Mar 1 04:02:00 enterprise CROND[15531]: (root) CMD (run-parts /etc/cron.daily)
Mar 1 04:02:01 enterprise anacron[15777]: Updated timestamp for job `cron.daily' to 2004-03-01
Mar 1 04:30:00 enterprise CROND[16014]: (root) CMD (updatedb)
Mar 1 04:42:00 enterprise CROND[16016]: (root) CMD (run-parts /etc/cron.monthly)
Mar 1 04:42:00 enterprise anacron[16020]: Updated timestamp for job `cron.monthly' to 2004-03-01
Mar 1 05:01:00 enterprise CROND[16022]: (root) CMD (run-parts /etc/cron.hourly)
-
Re: cron jobs not running
"Noi" wrote in message
news
an.2004.03.01.16.28.10.123015@siam.com...
> On Sun, 29 Feb 2004 17:43:10 -0800, Bob Meyers thoughtfully wrote:
>
> > On RedHat 8.0, if I am testing a background shell script to be run by
cron,
> > I can do add an entry in crontab, via 'crontab -e', with the minute
field
> > set to a couple of minutes in advance of current time. It seems these
jobs
> > will not run, with absolutely no entry/explanation in email or
> > /var/log/cron. If I edit the same crontab line and put a "*" for every
> > minute, it runs fine.
> >
> > Say it is now 17:30, if I enter crontab line
> >
> > 34 17 * * * /usr/local/bin/myscript
> >
> > Then wait until time is 17:40 and nothing happens. If I change it to
read
> >
> > * 17 * * * /usr/local/bin/myscript
> >
> > It works fine. Is there something I am missing?
>
> Any messages in /var/log/cron ?
> Mar 1 04:00:00 enterprise CROND[14625]: (root) CMD
(/home/noi/programs/chkrootkit.sh)
> Mar 1 04:01:01 enterprise CROND[15529]: (root) CMD (run-parts
/etc/cron.hourly)
Yes, I do have messages like your examples above. And when I checked it
today, 24 hours later, it did run myscript ok. So it appears that if I try
to schedule a job for only a few minutes ahead it won't run, but the above
example did indeed run at that time the next day. So cron is not responding
(running) to new jobs right away, even though /var/log/cron indeed shows it
has re-read the new job list after a "crontab -e", here are some typical
notations after an edit:
Feb 29 17:35:00 myhost crontab[24294]: (root) LIST (root)
Feb 29 16:35:00 myhost crond[731]: (root) RELOAD (cron/root)
Feb 29 17:37:00 myhost crontab[24320]: (root) LIST (root)
-
Re: cron jobs not running
On Mon, 01 Mar 2004 19:30:07 -0800, Bob Meyers thoughtfully wrote:
> "Noi" wrote in message
> news
an.2004.03.01.16.28.10.123015@siam.com...
>> On Sun, 29 Feb 2004 17:43:10 -0800, Bob Meyers thoughtfully wrote:
>>
>> > On RedHat 8.0, if I am testing a background shell script to be run by
> cron,
>> > I can do add an entry in crontab, via 'crontab -e', with the minute
> field
>> > set to a couple of minutes in advance of current time. It seems these
> jobs
>> > will not run, with absolutely no entry/explanation in email or
>> > /var/log/cron. If I edit the same crontab line and put a "*" for
>> > every minute, it runs fine.
>> >
>> > Say it is now 17:30, if I enter crontab line
>> >
>> > 34 17 * * * /usr/local/bin/myscript
>> >
>> > Then wait until time is 17:40 and nothing happens. If I change it to
> read
>> >
>> > * 17 * * * /usr/local/bin/myscript
>> >
>> > It works fine. Is there something I am missing?
>>
>> Any messages in /var/log/cron ?
>> Mar 1 04:00:00 enterprise CROND[14625]: (root) CMD
> (/home/noi/programs/chkrootkit.sh)
>> Mar 1 04:01:01 enterprise CROND[15529]: (root) CMD (run-parts
> /etc/cron.hourly)
>
> Yes, I do have messages like your examples above. And when I checked it
> today, 24 hours later, it did run myscript ok. So it appears that if I
> try to schedule a job for only a few minutes ahead it won't run, but the
> above example did indeed run at that time the next day. So cron is not
> responding (running) to new jobs right away, even though /var/log/cron
> indeed shows it has re-read the new job list after a "crontab -e", here
> are some typical notations after an edit: Feb 29 17:35:00 myhost
> crontab[24294]: (root) LIST (root) Feb 29 16:35:00 myhost crond[731]:
> (root) RELOAD (cron/root) Feb 29 17:37:00 myhost crontab[24320]: (root)
> LIST (root)
Cron should be checking every minute whether a user's crontab has been
changed and then execute the crontab entries.
Mar 2 09:41:40 enterprise crontab[8834]: (noi) END EDIT (noi)
Mar 2 09:41:44 enterprise crontab[8836]: (noi) LIST (noi)
Mar 2 09:42:00 enterprise crond[6367]: (noi) RELOAD (cron/noi)
Mar 2 09:44:00 enterprise CROND[8860]: (noi) CMD (echo `date +)
<=attempt to execute command
Mar 2 09:45:35 enterprise crontab[8870]: (noi) BEGIN EDIT (noi)
<=removing test entry
Mar 2 09:45:50 enterprise crontab[8870]: (noi) REPLACE (noi)
Mar 2 09:45:50 enterprise crontab[8870]: (noi) END EDIT (noi)
Mar 2 09:46:00 enterprise crond[6367]: (noi) RELOAD (cron/noi)
Usually I have that problem if the time I set is too close to the actual
time. You can check time mod time compared to actual time.
$ stat /var/spool/cron/root
-
Re: cron jobs not running
"Noi" wrote in message
news
an.2004.03.02.16.02.16.774446@siam.com...
>
> Usually I have that problem if the time I set is too close to the actual
> time. You can check time mod time compared to actual time.
>
> $ stat /var/spool/cron/root
I'll check that. Since I was testing a new script, I would edit my script,
then do a 'date' and crontab -e, setting it to run 2 or 3 minutes ahead. I
did try "/etc/rc.d/init.d/crond restart", and that made it run just fine. I
am used to Unix where I could set a job two minutes away and it would run
OK. Apparently Vixie-cron in RedHat is not doing what it says in the crond
man page.