backup_diff.sh, backup_full.sh: Prepared for in-place backups
[mgsautils.git] / fs / backup_diff.sh
old mode 100644 (file)
new mode 100755 (executable)
index 404b5e3..56cc4ac
@@ -1,4 +1,15 @@
-# PLACEHOLDER FILE!
-# This script is not yet ready for publication, as it contains environment-specific and/or hard-coded sensitive data.
-# This file is here to annoy myself to make an update.
-#      ~ MegaBrutal
+#!/bin/sh
+. $1
+FILENAME=${DIFFNAME}${APPEND}
+cd ${STORAGE}
+dar --verbose --alter=atime --empty-dir --fs-root / --noconf --create ${STORAGE}${FILENAME} --ref $(ls --sort=t ${STORAGE}*.dar | head -n 1 | cut -d. -f1) -y9 -an --exclude-from-file ${EXCLUDE}
+md5sum -b ${FILENAME}*.dar >> $(ls --sort=t ${FULLNAME}*.md5 | head -n 1)
+
+case "${XFER_METHOD}" in
+       scp)
+               su - ${XFER_USER} -c "scp -p ${STORAGE}${FILENAME}* $(ls --sort=t ${STORAGE}${FULLNAME}*.md5 | head -n 1) ${XFER_TARGET}"
+               ;;
+       rsync)
+               su - ${XFER_USER} -c "rsync -auv ${STORAGE} ${XFER_TARGET}"
+               ;;
+esac