scripts/backup

24 lines
693 B
Text
Raw Normal View History

2022-06-25 23:08:57 +00:00
#!/usr/bin/fish
2021-09-06 00:54:02 +00:00
# https://gist.github.com/bradfa/a710a4e4b83b07b7a8be77cae86ff56b
# https://gist.github.com/jasontbradshaw/6a69d7c9ae0c73f54200
2022-06-25 23:08:57 +00:00
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.
2022-06-25 23:08:57 +00:00
export BUP_DIR=$repository
2021-09-06 00:54:02 +00:00
# Create the backup repository if it doesn't exist.
2022-06-25 23:08:57 +00:00
if test -d $repository
bup init
chmod 700 $repository
end
2021-09-06 00:54:02 +00:00
# Do the backup as non-intrusively as possible.
2022-06-25 23:08:57 +00:00
echo "Indexing $name..."
nice -n19 ionice -c3 bup index -vv --exclude-rx-from=(status dirname)/exclude /etc /var /srv /home/ta180m
2021-09-06 00:54:02 +00:00
2022-06-25 23:08:57 +00:00
echo "Backing up $name to $repository..."
nice -n19 ionice -c3 bup save -vv --name=$name --compress=9