scripts/backup

24 lines
729 B
Bash
Executable file

#!/usr/bin/bash
# https://gist.github.com/bradfa/a710a4e4b83b07b7a8be77cae86ff56b
# https://gist.github.com/jasontbradshaw/6a69d7c9ae0c73f54200
name="$(date -u +'%Y-%m-%d')"
repository=/mnt/drive/bup/
# Set the `bup` directory here so it affects all the `bup` commands.
export BUP_DIR="${repository}"
# Create the backup repository if it doesn't exist.
if [ ! -d "${repository}" ]; then
bup init
chmod 700 "${repository}"
fi
# Do the backup as non-intrusively as possible.
echo "Indexing ${name}..."
nice -n19 ionice -c3 bup index -vv --exclude-rx-from=$(dirname "$0")/exclude /etc /var /srv /home/ta180m
echo "Backing up ${name} to '${repository}'..."
nice -n19 ionice -c3 bup save -vv --name="${name}" --compress=9 /