diff --git a/bakdb b/bakdb new file mode 100755 index 0000000..36a0dd7 --- /dev/null +++ b/bakdb @@ -0,0 +1,5 @@ +# !/bin/sh +db=$1 +pw=$2 +file=/dat/bak/db/${db}_`date +"%Y%m%d"`.sqlbak +mysqldump --lock-tables --user root -p"$pw" $db > $file diff --git a/bakupme.sh b/bakupme.sh index 5bb69aa..dcef6bd 100644 --- a/bakupme.sh +++ b/bakupme.sh @@ -4,10 +4,9 @@ REPOSITORY=pi@vdrpi:/media/hdext/borg borg create -v --stats --progress --compression zlib --one-file-system \ $REPOSITORY::'{hostname}-{now:%Y-%m-%d}' \ / \ - --exclude '/var/cache/apt/archives/*.deb' \ - --exclude '/var/cache/man' \ --exclude '*/tmp/*' \ - --exclude '/var/tmp' \ + --exclude '/var/tmp/*' \ + --exclude '/var/crash/*' \ --exclude '*/.cache/*' \ --exclude '*/cache/*' \ --exclude '*/.ccache/*' \ diff --git a/bakupnasdata.sh b/bakupnasdata.sh index 60414bd..3441771 100644 --- a/bakupnasdata.sh +++ b/bakupnasdata.sh @@ -7,6 +7,7 @@ borg create -v --stats --progress --compression zlib --one-file-system \ /dat/books \ /dat/audio \ /dat/docu/Foto \ + /dat/bak/db \ --exclude 'tmp' \ --exclude '*.iso' \ --exclude '/podcast/cache' \ diff --git a/bakupnasgps.sh b/bakupnasgps.sh index 5d1cfa1..abf8f98 100644 --- a/bakupnasgps.sh +++ b/bakupnasgps.sh @@ -1,10 +1,11 @@ #!/bin/sh REPOSITORY=pi@vdrpi:/media/hdext/borg PREFIX=nasgps +BAKDIRS="/dat/docu/gps" borg create -v --stats --progress --compression zlib --one-file-system \ - $REPOSITORY::'nasgps-{now:%Y-%m-%d}' \ - /dat/docu/gps \ + $REPOSITORY::$PREFIX-'{now:%Y-%m-%d}' \ + $BAKDIRS \ --exclude '*/tmp/*' \ --exclude '*.iso' \ --exclude '*.exe' \ @@ -20,5 +21,5 @@ borg create -v --stats --progress --compression zlib --one-file-system \ # archives of THIS machine. The '{hostname}-' prefix is very important to # limit prune's operation to this machine's archives and not apply to # other machine's archives also. -borg prune -v $REPOSITORY --prefix 'nasgps-' \ +borg prune -v $REPOSITORY --prefix $PREFIX- \ --keep-daily=7 --keep-weekly=4 --keep-monthly=20 diff --git a/borgbak.sh b/borgbak.sh new file mode 100644 index 0000000..bc3b328 --- /dev/null +++ b/borgbak.sh @@ -0,0 +1,19 @@ +#!/bin/sh +REPOSITORY=root@vdrpi:/mnt/hd/borg + +# Backup all of /home and /var/www except a few +# excluded directories +borg create -v --stats \ + $REPOSITORY::'{hostname}-{now:%Y-%m-%d}' \ + /home \ + /var/www \ + --exclude '/home/*/.cache' \ + --exclude /home/Ben/Music/Justin\ Bieber \ + --exclude '*.pyc' + +# Use the `prune` subcommand to maintain 7 daily, 4 weekly and 6 monthly +# archives of THIS machine. The '{hostname}-' prefix is very important to +# limit prune's operation to this machine's archives and not apply to +# other machine's archives also. +borg prune -v $REPOSITORY --prefix '{hostname}-' \ + --keep-daily=7 --keep-weekly=4 --keep-monthly=6