2019-10-13 14:07:14 +00:00
|
|
|
#! /bin/bash
|
2021-02-23 11:58:09 +00:00
|
|
|
|
|
|
|
if [[ `nmcli -t -f GENERAL.METERED dev show | grep "METERED:yes"` ]]; then
|
|
|
|
echo Backup does not work on metered connections
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2021-02-20 17:55:12 +00:00
|
|
|
if [[ -z $CONTABO_BACKUP_PATH ]]; then
|
|
|
|
echo CONTABO_BACKUP_PATH environment not set
|
|
|
|
exit 1
|
|
|
|
fi
|
2019-10-13 14:07:14 +00:00
|
|
|
sleep 60
|
2022-01-22 22:14:01 +00:00
|
|
|
|
|
|
|
# Backup Contabo
|
|
|
|
/bin/rsync --archive --exclude "files/nextcloud*" --rsh=ssh backupContabo:/home/bruno/backups/* $CONTABO_BACKUP_PATH
|
|
|
|
|
|
|
|
# Backup OXO
|
|
|
|
/bin/rsync --archive --rsh=ssh oxo:~/OXOwebsiteBackup.tar.gz ~/Backups/OXOwebsite/`date '+%Y-%m-%d'`_OXOwebsiteBackup.tar.gz
|
2019-10-13 14:07:14 +00:00
|
|
|
|
|
|
|
# Delete old backups
|
2021-02-20 17:55:12 +00:00
|
|
|
find $CONTABO_BACKUP_PATH/db -type f -name "*.sql.gz" -mtime +15 -delete
|
|
|
|
find $CONTABO_BACKUP_PATH/keys -type f -name "*.*" -mtime +15 -delete
|
|
|
|
find $CONTABO_BACKUP_PATH/files -type f -name "*.*" -mtime +35 -delete
|
|
|
|
find $CONTABO_BACKUP_PATH/mail -type f -name "*.*" -mtime +20 -delete
|
2019-10-13 14:07:14 +00:00
|
|
|
|
2021-02-20 17:55:12 +00:00
|
|
|
find $CONTABO_BACKUP_PATH/ -type f -name "*.*" -mtime +120 -delete
|
2022-01-22 22:14:01 +00:00
|
|
|
|
|
|
|
find ~/Backups/OXOwebsite/ -type f -name "*.sql.gz" -mtime +15 -delete
|