Re: using cron
On Thu, Apr 21, 2005 at 04:15:45PM -0400, Hal Vaughan wrote:
> On Thursday 21 April 2005 04:08 pm, brandon wrote:
> > Hi, suppose i want to run a backup script daily that zips up some of my
> > configuration files and place it in my home directory.
> >
> > I created a file named backup, and put a single line command in it
> >
> > tar -zcvf /home/brandon/backup.tar.gz2 /etc/fstab /etc/X11/XF86Config-4
> > (and other files)
> >
> > i did a chmod +rwx on it, and placed it in the /etc/cron.daily/ directory.
> >
> > i tested the script using ./backup and it works as intended
> >
> > However some days have passed and it hasnt run once yet. what else
> > should i do to make it work?
>
> You don't put the script itself in the directory. Actually, you don't touch
> those directories. (How would cron know when to run it???)
By this in /etc/crontab, I'd think:
25 6 * * * root test -x /usr/sbin/anacron || run-parts --report /etc/cron.daily
Do you see something like this in your syslog by chance?
run-parts: failed to exec /etc/cron.daily/backup: Exec format error
run-parts: /etc/cron.daily/backup exited with return code 1
As other pointed out -- you need the shebang line for run-parts.
--
Bill Moseley
moseley@hank.org
Reply to: