Added the ability to change backup location and compression

This commit is contained in:
tofasthacker 2023-06-14 21:22:02 +00:00
parent ec443ce192
commit a61cebe7c6

20
backup
View File

@ -1,5 +1,9 @@
#!/bin/bash #!/bin/bash
BACKUP_LOCATION="/nas/share/backup.tar"
echo ' echo '
________ ________ ________ ___ __ ___ ___ ________ _________ ________ ________ ___ ________ ________ ________ ___ __ ___ ___ ________ _________ ________ ________ ___
|\ __ \|\ __ \|\ ____\|\ \|\ \ |\ \|\ \|\ __ \ |\___ ___\\ __ \|\ __ \|\ \ |\ __ \|\ __ \|\ ____\|\ \|\ \ |\ \|\ \|\ __ \ |\___ ___\\ __ \|\ __ \|\ \
@ -19,17 +23,25 @@ echo ""
echo -e "\e[0mStarting Backup" echo -e "\e[0mStarting Backup"
tar -cvf /nas/share/backup.tar ./*.bak tar -cvf $BACKUP_LOCATION ./*.bak
while read folder; do while read folder; do
# list the contents of each folder # list the contents of each folder
echo -e "\e[32mbackingup: $folder" echo -e "\e[32mbackingup: $folder"
tar -rf /nas/share/backup.tar $folder &>/dev/null tar -rf $BACKUP_LOCATION $folder &>/dev/null
done < *.bak done < *.bak
echo "" echo ""
#echo -e "\e[0mCompressing backup"
#gzip /nas/share/backup.tar
if [ "$COMPRESS" = true ];
then
echo -e "\e[0mCompressing backup"
gzip $BACKUP_LOCATION
echo -e "\e[0mRemoving Uncompressed backup"
rm -f $BACKUP_LOCATION
fi
echo -e "\e[0mBackup Done" echo -e "\e[0mBackup Done"