From 9ee18bae78de2345c36dd71e7cfe9ff6a19375f9 Mon Sep 17 00:00:00 2001 From: locker98 Date: Sun, 25 Aug 2024 14:56:46 -0400 Subject: [PATCH] fixed gitignore --- .gitignore | 4 ++-- rsync_backups/rsync_backup | 42 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 2 deletions(-) create mode 100755 rsync_backups/rsync_backup diff --git a/.gitignore b/.gitignore index d7013da..90b5108 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ -rsync_backup/*.bak -tar_backup/*.txt +*.bak +*.txt 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" + +