#!/bin/sh # # $Header: /CVSROOT/public/scylla-charybdis/md5backup/bin/sc-backup.sh,v 1.8 2004/09/29 23:32:44 tino Exp $ # # $Log: sc-backup.sh,v $ # Revision 1.8 2004/09/29 23:32:44 tino # many minor and mini fixes, sc-loop.sh should work again # # Revision 1.7 2004/07/25 09:16:41 tino # see ChangeLog: bugfixes in bin/dobackup.sh and tinolib # # Revision 1.6 2004/07/05 18:11:24 tino # some more logging in bin/sc-*.sh # # Revision 1.5 2004/07/05 17:18:29 tino # working version # # Revision 1.4 2004/06/27 15:20:43 tino # bugfix # # Revision 1.3 2004/06/18 23:51:16 tino # see ChangeLog # # Revision 1.2 2004/05/15 14:45:38 tino # updated # # Revision 1.1 2004/05/04 05:11:01 tino # sc-backup.sh: backup via scylla+charybis; dobackup.sh convenience script cd "`dirname "$0"`" || exit 1 case "$1" in '') TARG=md5move;; */*) echo "argument $1 must not be a path!"; exit 1;; esac if [ ! -d "$TARG" ] then echo "no dir $TARG" exit 1 fi > "tmp/log.$TARG" log() { loga="$1" shift printf "%s: $loga\n" "`date +'%Y-%m-%d %H:%M:%S'`" "$@" >> "tmp/log.$TARG" } ./sc-mysql.sh "$TARG" || exit 1 ( here="`/bin/pwd`" cd ../md5backup || exit 1 # create some additional ignores # these are not deleted afterwards, # as if you have more than one target, # you want to ignore them all. cat <"ign/sc-backup.$TARG.tmp.ignores" $here/$TARG $here/tmp EOF ./dobackup.sh ) || exit 1 HOST="`hostname -f`" # Works with Hostname set [ -z "$HOST" ] && HOST="`hostname`" # Last resort [ -z "$HOST" ] && HOST="`cat /etc/hostname`" LASTLINE="../md5backup/log/$HOST" LASTLINE="`tail -1 "$LASTLINE"`" echo "$LASTLINE" >> "tmp/log.$TARG" echo "$LASTLINE $TARG" >> tmp/log for a in md5 log do [ -L "$TARG/$a" ] && continue [ -d "$TARG/$a" ] || mkdir "$TARG/$a" || exit 1 ln -f "../md5backup/$a"/* "$TARG/$a" || exit 1 done # Following steps are intrinsically skipped if not needed: ./sc-move.sh "$TARG" || # Transport broken file list ./sc-move.sh "$TARG" || # Create new file list ./sc-move.sh "$TARG" || # Transport new data ./sc-move.sh "$TARG" || # Create file list again ./sc-move.sh "$TARG" || # Verify (and remove) the data # If everything worked, no files shall be left by now echo "Still work left for sc-move.sh $TARG" && exit 2