Backups completely filling root drive.
Larry Alkoff
labradley at mindspring.com
Thu Sep 28 02:52:35 UTC 2006
Hi Tony. Yes I tried it late today. It took nearly 4 hours to transfer
11.5 gigs but that was onto a virgin disk. So I'm quite happy with it.
I greatly simplified the script - it's below.
Larry
root at kinda bin # cat backmost
#!/bin/bash
# lba: backmost - use rsync to update a hard disk
# Variables:
#TESTING=--dry-run
TESTING=
MIRROR=/mnt/mirror
# TEE=2>&1 |tee >>/var/log/mirror.log
TEE='tee >>/var/log/mirror.log'
# make sure we're running as root
if [ `/usr/bin/id -u` != 0 ]; then { /bin/echo "Sorry only root can do
this. Exiting..."; exit 1; } fi
# Only -n parameter allowed
#if [ ! $1 = "-n" ]; then
# echo Bad parameter. Aborting!
# exit 1
#fi
# Test to make sure both source and target are specified and are
directories:
if [ ! "$1" -o ! "$2" -o ! -d "$1" -o ! -d "$2" ]; then
echo Syntax: syncdir[n] source_dir/ target_dir/
echo Both must be directories. Aborting!
exit 1
fi
# Test to make sure each directory parameter ends with an '/'.
## if [ ! `echo $1 |egrep '\/$'` -o ! `echo $2 |egrep '\/$'` ];
then This doesn't work - binar
# y operator required. Why?
#if [ ! `echo $1 |egrep '\/$'` ] || [ ! `echo $2 |egrep '\/$'` ]; then
# echo You must end both directory names with a / backslash.
Aborting!
# exit 1
#fi
mv /var/log/backmost.log /var/log/backmost.log~
# Does not include lost+found/ media/ mnt/ proc/ sys/ tmp/ srv??/ dev??/
EXCLUDE="--exclude dev/ --exclude list+found/ --exclude media/ --exclude
mnt/ \
--exclude proc/ --exclude sys/ --exclude tmp/ --exclude srv/"
# note: --exclude is relative to the source path. Above works!
echo Backup is quiet but logged in /var/log/backmost.log.
echo Please wait for ending beep ...
# This uses -n for testing:
#rsync -uaHcv -n --delete $EXCLUDE $1 $2 >>/var/log/backmost.log
rsync -uaHcv --delete $EXCLUDE $1 $2 >>/var/log/backmost.log
beep # say we done
exit
--
Larry Alkoff N2LA - Austin TX
Using Thunderbird on Linux
More information about the ubuntu-users
mailing list