sh 使用Borg的简短备份脚本

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh 使用Borg的简短备份脚本相关的知识,希望对你有一定的参考价值。

#!/bin/bash
# Inspired by https://borgbackup.readthedocs.org/en/stable/quickstart.html
#             https://gist.github.com/ericmieth/c045edebb0709dfd88e1
# Created by mushu 2016-02-04
# Mounting the volume:
cryptsetup --key-file <keyfile> luksOpen UUID=<deviceUUID> cryptBackup
mount /dev/mapper/cryptBackup /mnt
# Performing the backup:
name=$(date -I)
sources='/etc /home /root'
target='/mnt/backups'
# Create a new backup:
borg create --exclude-caches $target::$name $sources
# Remove old backups:
borg prune -v $target --keep-daily=7 --keep-weekly=4 --keep-monthly=6
# Display current backups:
borg list $target
# Umounting the volume:
sync && umount /mnt
cryptsetup luksClose /dev/mapper/cryptBackup
#!/bin/bash
# Inspired by https://borgbackup.readthedocs.org/en/stable/quickstart.html
#             https://gist.github.com/ericmieth/c045edebb0709dfd88e1
# Created by mushu 2016-02-22
# Mounting the volume:
cryptsetup --key-file <keyFile> luksOpen UUID=<deviceUUID> cryptBackup
mount /dev/mapper/cryptBackup /mnt
# Verifying current backups:
borg check /mnt/backups
# Umounting the volume:
sync && umount /mnt
cryptsetup luksClose /dev/mapper/cryptBackup
# Scrub local btrfs:
btrfs scrub start / -B
# Going to sleep:
systemctl suspend

以上是关于sh 使用Borg的简短备份脚本的主要内容,如果未能解决你的问题,请参考以下文章

sh 使用s3cmd和rsnapshot备份脚本

Oracle数据库RMAN的自动备份脚本简介

sh 使用mongorestore从S3备份恢复mongodb数据库的简单shell脚本

数据库备份脚本.sh

shell脚本练习

shell脚本定时备份日志===logBackup.sh