- Moved hard-coded data to separate config file.
- Now it is configurable how to transfer backup files to a remote server:
it is possible by scp or rsync, or to not transfer them at all.
The backup directory may be mounted from a remote server by NFS or other method,
in which case there is no need to transfer the files by scp or rsync.
Note however, backup_full.sh purges the backup directory, because it is assumed
that the files have already been transferred to a remote location.
modified: fs/backup_diff.sh
new file: fs/backup_fsdiff.conf
modified: fs/backup_full.sh
-# 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 *.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
--- /dev/null
+FULLNAME=filesys_$(hostname -s)_full
+DIFFNAME=filesys_$(hostname -s)_diff
+APPEND=$(date +%Y%m%d)
+STORAGE=/var/backups/fs/data/
+EXCLUDE=/var/backups/fs/exclude.lst
+
+XFER_METHOD=scp
+XFER_USER=backup
+XFER_TARGET=
-# 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=${FULLNAME}${APPEND}
+cd ${STORAGE}
+rm *
+dar --verbose --alter=atime --empty-dir --fs-root / --noconf --create ${STORAGE}${FILENAME} -y9 -an --exclude-from-file ${EXCLUDE}
+md5sum -b ${FILENAME}* > ${FILENAME}.md5
+chown ${XFER_USER} ${FILENAME}.md5
+
+case "${XFER_METHOD}" in
+ scp)
+ su - ${XFER_USER} -c "scp -p ${STORAGE}${FILENAME}* ${XFER_TARGET}"
+ ;;
+ rsync)
+ su - ${XFER_USER} -c "rsync -auv ${STORAGE} ${XFER_TARGET}"
+ ;;
+esac