Backup script now works on new server

This commit is contained in:
Bruno F. Fontes 2021-02-20 14:55:12 -03:00
parent 60972813b0
commit b34416de14
Signed by: brunofontes
GPG Key ID: EE3447CE80048495

View File

@ -1,10 +1,15 @@
#! /bin/bash #! /bin/bash
if [[ -z $CONTABO_BACKUP_PATH ]]; then
echo CONTABO_BACKUP_PATH environment not set
exit 1
fi
sleep 60 sleep 60
/bin/rsync -a -e "ssh -i /home/bruno/.ssh/id_rsa_backup" mybackup@167.86.78.36:/home/bruno/backups/* /home/bruno/Backups/Contabo/ /bin/rsync --archive --exclude "files/nextcloud*" -e "ssh" backupContabo:/home/bruno/backups/* $CONTABO_BACKUP_PATH
# Delete old backups # Delete old backups
find /home/bruno/Backups/Contabo/db -type f -name "*.sql.gz" -mtime +15 -delete find $CONTABO_BACKUP_PATH/db -type f -name "*.sql.gz" -mtime +15 -delete
find /home/bruno/Backups/Contabo/files -type f -name "*.*" -mtime +35 -delete find $CONTABO_BACKUP_PATH/keys -type f -name "*.*" -mtime +15 -delete
find /home/bruno/Backups/Contabo/mail -type f -name "*.*" -mtime +20 -delete find $CONTABO_BACKUP_PATH/files -type f -name "*.*" -mtime +35 -delete
find $CONTABO_BACKUP_PATH/mail -type f -name "*.*" -mtime +20 -delete
find /home/bruno/Backups/Contabo/ -type f -name "*.*" -mtime +120 -delete find $CONTABO_BACKUP_PATH/ -type f -name "*.*" -mtime +120 -delete