Re: backup script partly fails when in cron.weekly
Ok, first: Why it doesn't work I simply don't know.
You should test if this is a problem with find, or the egrep command,
cpio or cat by making verbose output into a own log file.
But maybe you should not use this (in my opinion) unusual command "find
/ -print ...". Instead use tar, like:
tar -zcvf /media/mirror/`date +%F`.tar.gz -C / --exclude=/media/*
--exclude=/proc/* --exclude=/sys/* --exclude=/mnt/*
(please test this first before going productive)
or use rsync. You will find a lot of examples in our great? world.
Best regards,
Benjamin Schmidt
Haines Brown wrote:
> I asked this question some time ago. I've a script in /etc/cron.weekly
> named "backup" (rwxr-xr-x root/root) that looks like this:
>
> #!/bin/sh
> mount /media/mirror
> dirName=`date +%F`
> mkdir /media/mirror/"$dirName"
> find / -print | egrep -v "^/media|^/proc|^/sys|^/mnt" | cpio -pdmuv \
> /media/mirror/"$dirName" 2>&1 | cat -vt
> umount /media/mirror
> exit 0
>
> I regularly get only partial backups when run by cron, but full
> backups if run from command line by root.
>
> For example, in / I have two symlinks. Both are rwxrwxrwx root/root,
> but only one gets backed up.
>
> Another example, /home gets backed up, but /etc does not, even though
> both are rwxr-xr-x root/root,
>
> Yet another example: In / I have two plain text files, both are
> rw-r--r-- root/root, but only one gets backed up.
>
> Plenty of room on the backup device (external UPS drive). My syslog
> reports the backup started. No other log entries of interest:
>
> Dec 9 04:00:01 teufel /USR/SBIN/CRON[23041]:
> (brownh) CMD (/home/brownh/scripts/backup)
> Dec 9 04:00:01 teufel /USR/SBIN/CRON[23043]: (brownh) CMD (fetchmail)
> Dec 9 04:00:01 teufel kernel:
> kjournald starting. Commit interval 5 seconds
> Dec 9 04:00:01 teufel kernel: EXT3-fs warning: maximal mount count
> reached, running e2fsck is recommended
> Dec 9 04:00:01 teufel kernel: EXT3 FS on sdd1, internal journal
> Dec 9 04:00:01 teufel kernel: EXT3-fs: mounted filesystem with
> ordered data mode.
> Dec 9 04:00:01 teufel identd[23056]: started
>
Reply to: