fixed relative path problem
This commit is contained in:
parent
c94339deca
commit
4876caec39
@ -1,38 +1,36 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
if [ $# -ne 1 ]; then
|
if [ $# -ne 2 ]; then
|
||||||
echo "Usage: $0 <backup_location>"
|
echo "Usage: $0 <file lists> <backup_location>"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
echo 'backing up the following folders:'
|
echo "backing up the following folders: ${1}/backup.txt"
|
||||||
echo -e "\e[32m-------------------------------------------"
|
echo -e "\e[32m-------------------------------------------"
|
||||||
cat backup.txt
|
cat "${1}/backup.txt"
|
||||||
|
|
||||||
echo ""
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
echo -e '\e[0mexclude the following folders:'
|
echo -e "\e[0mexclude the following folders: ${1}/exclude.txt"
|
||||||
echo -e "\e[32m-------------------------------------------"
|
echo -e "\e[32m-------------------------------------------"
|
||||||
cat exclude.txt
|
cat "${1}/exclude.txt"
|
||||||
|
|
||||||
|
|
||||||
|
mkdir -p $2
|
||||||
|
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
echo -e "\e[0mStarting Backup"
|
echo -e "\e[0mStarting Backup"
|
||||||
|
|
||||||
rsync -rptgpXh --delete-excluded --delete-before --stats --exclude-from=./exclude.txt --include-from=./backup.txt $@ > backup_data_tmp 2>&1
|
rsync -rptgpXh --delete-excluded --delete-before --progress --stats --exclude-from="${1}/exclude.txt" --files-from="${1}/backup.txt" / $2 > /tmp/backup_data_tmp 2>&1
|
||||||
|
|
||||||
|
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
curl -H "Title: Backup: $(hostname)" -d "The backup on $(hostname) finished successfully. $(cat ./backup_data_tmp | grep -v '^[d-]' | grep -v '^skipping')" https://ntfy.locker98.com/camera_h9CQ0
|
curl -H "Title: Backup: $(hostname)" -d "The backup on $(hostname) finished successfully. $(tail -n 17 /tmp/backup_data_tmp)" https://ntfy.locker98.com/camera_h9CQ0
|
||||||
else
|
else
|
||||||
curl -H "Title: Backup: $(hostname)" -H "Priority: urgent" -H "Tags: warning" -d "The backup on $(hostname) failed. $(cat ./backup_data_tmp | grep -v '^[d-]' | grep -v '^skipping')" https://ntfy.locker98.com/camera_h9CQ0
|
curl -H "Title: Backup: $(hostname)" -H "Priority: urgent" -H "Tags: warning" -d "The backup on $(hostname) failed. $(tail -n 17 /tmp/backup_data_tmp)" https://ntfy.locker98.com/camera_h9CQ0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm ./backup_data_tmp
|
#rm /tmp/backup_data_tmp
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo -e "\e[0mBackup Done"
|
echo -e "\e[0mBackup Done"
|
||||||
|
Loading…
Reference in New Issue
Block a user