User_4574's miniblog

Where thoughts go to die

Home Archives Feed Post
Byteback Dynamic Excludes [Permalink] [Tweet] 26-09-2016 21:13 UTC

Bytemark make a decent backup tool here.

It has a file /etc/byteback/excludes in which you can list directories to be excluded. This is great, but it would be more useful if I could identify this in the directory in question. Byteback... doesn't do this.

So I did. :D

I threw together the following exceptionally simple bash script which achieves this.

#!/bin/bash

if [[ $EUID -ne 0 ]]; then
echo "Need to be root" >&2
exit 1
fi

echo "Building dynamic exclude list..."
find / -name '.do_not_backup' | xargs dirname > /etc/byteback/excludes

echo "Merging static includes..."
cat /etc/byteback/excludes.merge >> /etc/byteback/excludes

echo "Running byteback..."
byteback-backup $*

In order for this to work, you need to touch .do_not_backup in any directory, and that directory won't get backed up. You can continue using /etc/byteback/excludes.merge as a static excludes list.

You just need to use this script instead of byteback-backup, and the $* means it will take and pass on the arguments to the byteback-backup call.