From 49fc68c5322e86432dd43e452711df88b4cf443b Mon Sep 17 00:00:00 2001 From: locker98 Date: Sun, 25 Aug 2024 14:36:50 -0400 Subject: [PATCH] added rsync --- rsync_backups/backup.txt | 1 + rsync_backups/exclude.txt | 1 + rsync_backups/rsync_backup | 42 +++++++++++++++++++++++++++++++++++++ backup => tar_backup/backup | 0 tar_backup/files.bak | 13 ++++++++++++ 5 files changed, 57 insertions(+) create mode 100644 rsync_backups/backup.txt create mode 100644 rsync_backups/exclude.txt create mode 100755 rsync_backups/rsync_backup rename backup => tar_backup/backup (100%) create mode 100644 tar_backup/files.bak diff --git a/rsync_backups/backup.txt b/rsync_backups/backup.txt new file mode 100644 index 0000000..5f729e8 --- /dev/null +++ b/rsync_backups/backup.txt @@ -0,0 +1 @@ +/home/brickman/github/ diff --git a/rsync_backups/exclude.txt b/rsync_backups/exclude.txt new file mode 100644 index 0000000..5cbeca8 --- /dev/null +++ b/rsync_backups/exclude.txt @@ -0,0 +1 @@ +/home/brickman/Desktop/mos_music diff --git a/rsync_backups/rsync_backup b/rsync_backups/rsync_backup new file mode 100755 index 0000000..438808a --- /dev/null +++ b/rsync_backups/rsync_backup @@ -0,0 +1,42 @@ +#!/bin/bash +if [ $# -ne 1 ]; then + echo "Usage: $0 " + exit 1 +fi + + +echo 'backing up the following folders:' +echo -e "\e[32m-------------------------------------------" +cat backup.txt + +echo "" +echo "" + +echo -e '\e[0mexclude the following folders:' +echo -e "\e[32m-------------------------------------------" +cat exclude.txt + + + + +echo "" + +echo -e "\e[0mStarting Backup" + +rsync -rptgpXh --delete-excluded --delete-before --stats --exclude-from=./exclude.txt --include-from=./backup.txt $@ | grep -v '^skipping' | grep -v '^[d-]' | tee backup_data_tmp + + +if [ $? -eq 0 ]; then + curl -H "Title: Backup: $(hostname)" -d "The backup on $(hostname) finished successfully. $(cat ./backup_data_tmp)" https://ntfy.locker98.com/camera_h9CQ0 +else + echo "The backup on $(hostname) failed. /n" > "$tempfile" + cat ./backup_data_tmp >> "$tempfile" + curl -H "Title: Backup: $(hostname)" -H "Priority: urgent" -H "Tags: warning" -d "The backup on $(hostname) failed. $(cat ./backup_data_tmp)" https://ntfy.locker98.com/camera_h9CQ0 +fi + +rm ./backup_data_tmp + +echo "" +echo -e "\e[0mBackup Done" + + diff --git a/backup b/tar_backup/backup similarity index 100% rename from backup rename to tar_backup/backup diff --git a/tar_backup/files.bak b/tar_backup/files.bak new file mode 100644 index 0000000..a4c1289 --- /dev/null +++ b/tar_backup/files.bak @@ -0,0 +1,13 @@ +/home/brickman/Arduino +/home/brickman/.bash_history +/home/brickman/.bashrc +/home/brickman/Desktop +/home/brickman/Documents +/home/brickman/Downloads +/home/brickman/github +/home/brickman/gpg-public-key.asc +/home/brickman/mouse_program.py +/home/brickman/Seafile +/home/brickman/start +/home/brickman/Uploads +/home/brickman/vpn