backupskripte

This commit is contained in:
Marc Hoppe
2017-01-07 21:18:53 +01:00
parent 61d351c7e0
commit 3731b1551b
5 changed files with 31 additions and 6 deletions

5
bakdb Executable file
View File

@@ -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

View File

@@ -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/*' \

View File

@@ -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' \

View File

@@ -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

19
borgbak.sh Normal file
View File

@@ -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