#!/usr/bin/fish # Create an incremental system backup using bup # Useful resources: # 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 test -d $repository bup init chmod 700 $repository end # Do the backup as non-intrusively as possible. echo "Indexing $name..." nice -n19 ionice -c3 bup index -vv --exclude-rx-from=(status dirname)/exclude /etc /var /srv /home/ta180m echo "Backing up $name to $repository..." nice -n19 ionice -c3 bup save -vv --name=$name --compress=9