Dave, 2004-03-12 22:25:27: > I'm trying to run a daily back automatically using anacron > I've written a sh-script (called - "daily.snapshot") using rsync which > works fine on the command line as root (if executed manually) and put > it in /usr/local/bin
It might be tidier to move it to /usr/local/sbin, based on what the script does and who will be running it. (Doesn't "matter" though :) > The next stage is to use anacron to run it for me daily. [..snip..] > From the reading/googling I've done I understand that I need to add a > line to anacrontab this is what I've come up with: > # /etc/anacrontab: configuration file for anacron > # See anacron(8) and anacrontab(5) for details. > SHELL=/bin/sh > PATH=/sbin:/bin:/usr/sbin:/usr/bin:/:/usr/local/bin > # These replace cron's entries > 1 60 cron.daily nice run-parts --report /etc/cron.daily > 7 75 cron.weekly nice run-parts --report /etc/cron.weekly > 30 90 cron.monthly nice run-parts --report /etc/cron.monthly > 1 100 daily.snapshot nice daily.snapshot --report /var/log/daily.snapshot > whaddya recon?? I think it looks like your distro works a lot like mine (Debian). If so, /etc/cron.daily, /etc/cron.weekly and /etc/cron.monthly are directories. The idea is for you to drop your scripts into those directories. The system takes care of the rest (incl. running the scripts sequentially, according to their filenames - see "man run-parts"). So, instead of tweaking /etc/anacrontab, you could just drop something like this into /etc/cron.daily and chmod +x it: #!/bin/sh # This file is: /etc/cron.daily/my-snapshot # Uncomment the following line to disable snapshots #exit 0 MYSCRIPT=/usr/local/sbin/daily.snapshot [ -x /usr/sbin/sendmail ] || exit 0 if [ ! -x "$MYSCRIPT" ]; then echo "Can't find $MYSCRIPT" exit 1 fi $MYSCRIPT (Have a look at the other scripts in /etc/cron.daily|weekly|monthly.) I hope that's some help, Tim -- Timothy Musson - [EMAIL PROTECTED] http://homepages.ihug.co.nz/~trmusson/
