backupskripte
This commit is contained in:
5
bakdb
Executable file
5
bakdb
Executable 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
|
||||
@@ -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/*' \
|
||||
|
||||
@@ -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' \
|
||||
|
||||
@@ -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
19
borgbak.sh
Normal 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
|
||||
Reference in New Issue
Block a user