dotfiles/.bin/tarsnap-backup

14 lines
353 B
Plaintext
Raw Normal View History

2023-02-22 08:31:38 +01:00
#!/bin/sh
. $HOME/.bin/_config
[ -d "$1" ] || ( printf "Usage: backup <target>\n" && exit 2; )
print "Tarsnap Backup:"
_target=$(readlink -f "$1")
_key=$(pwgen -n1 8)
_date=$(date "+%Y-%m-%d %H:%M")
_host=$(uname -n)
doas tarsnap --humanize-numbers --checkpoint-bytes 52428800 --exclude "*/.git/*" -cvf "$_host: $_target $_date ($_key)" "$_target"