Re: persistent cron error
Chris declaimed:
> On Thu, 2004-02-19 at 17:44, Paul Mackinney wrote:
> > I get the following error for a cron job that runs ntpdate:
> > Date: Thu, 19 Feb 2004 06:26:42 -0800
> > From: Cron Daemon
> > Subject: Cron <root@dog> test -e /usr/sbin/anacron || run-parts --report
> > /etc/cron.daily
> > To: root
> >
> > /etc/cron.daily/ntpdate:
> > run-parts: failed to exec /etc/cron.daily/ntpdate: Exec format error
> > run-parts: /etc/cron.daily/ntpdate exited with return code 1
> >
> > The file format _looks_ ok to me, and the commands succeed when run
> > manually in the shell (including the if...then conditions).
> > Any suggestions?
> >
> > /etc/cron.daily/ntpdate:
> > # cron script to run ntp client & sync clock.
> > #
> > # Run queue at 09:20
> > # m h dom mon dow user command
> > @reboot root \
> > if [ -x /usr/sbin/ntpdate ]; then \
> > /usr/sbin/ntpdate -s ntp.ucsd.edu ntp1.mainecoon.com; \
> > fi
> > 20 9 * * * root \
> > if [ -x /usr/sbin/ntpdate ]; then \
> > /usr/sbin/ntpdate -s ntp.ucsd.edu ntp1.mainecoon.com; \
> > fi
> > # <verbose comments about the ntp servers truncated>
> >
> I think /etc/cron.daily is not where you want to put your script. Try
> /etc/cron.d/.
>
> man cron:
>
> Additionally, cron reads the files in /etc/cron.d: it treats the files
> in /etc/cron.d as extensions to the /etc/crontab file (they follow the
> special format of that file, i.e. they include the user field). The
> intended purpose of this feature is to allow packages that require finer
> control of their scheduling than the /etc/cron.{daily,weekly,monthly}
> directories allow to add a crontab file to /etc/cron.d.
Thanks. The other scripts in cron.daily certainly don't use the
schedules or user field, I'll give it a try.
PM
--
Paul Mackinney
paul@mackinney.net
Reply to: