backup script partly fails when in cron.weekly
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
--
Haines Brown, KB1GRM
Reply to: