2021-09-06 00:54:02 +00:00
|
|
|
#!/usr/bin/bash
|
|
|
|
|
|
|
|
# https://gist.github.com/bradfa/a710a4e4b83b07b7a8be77cae86ff56b
|
|
|
|
# https://gist.github.com/jasontbradshaw/6a69d7c9ae0c73f54200
|
|
|
|
|
|
|
|
name="$(date -u +'%Y-%m-%d')"
|
2022-01-10 13:47:19 +00:00
|
|
|
repository=/mnt/drive/bup/
|
2021-09-06 00:54:02 +00:00
|
|
|
|
|
|
|
# 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
|
2022-01-10 13:47:19 +00:00
|
|
|
chmod 700 "${repository}"
|
2021-09-06 00:54:02 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Do the backup as non-intrusively as possible.
|
|
|
|
echo "Indexing ${name}..."
|
2022-05-24 19:57:18 +00:00
|
|
|
nice -n19 ionice -c3 bup index -vv --exclude-rx-from=$(dirname "$0")/exclude /etc /var /srv /home/ta180m
|
2021-09-06 00:54:02 +00:00
|
|
|
|
|
|
|
echo "Backing up ${name} to '${repository}'..."
|
2022-05-24 19:55:15 +00:00
|
|
|
nice -n19 ionice -c3 bup save -vv --name="${name}" --compress=9 /
|