Update pibackup.sh

This commit is contained in:
2022-10-08 16:24:35 -05:00
parent 847fc0e140
commit 7c1bd4d41f

View File

@@ -1,6 +1,6 @@
#!/bin/bash
TEST=true;
TEST="true";
if [ "$1" != "update" ]; then
@@ -39,14 +39,14 @@ if [ "$1" != "update" ]; then
[ ! -d "$BackupDir" ] && mkdir -p "$BackupDir"
echo "$(date) - Starting Backup"
if [ TEST != true ]; then dd if=${dtype} of=${BackupDir}/$(date +%Y-%m-%d).img bs=1M status=progress; fi;
if [ $TEST != true ]; then dd if=${dtype} of=${BackupDir}/$(date +%Y-%m-%d).img bs=1M status=progress; fi;
echo "$(date) - Backup Complete"
if [ TEST != true ]; then sleep 1m; fi;
if [ $TEST != true ]; then sleep 1m; fi;
echo "$(date) - Starting PiShrink"
if [ TEST != true ]; then source /opt/idssys/pibackup/pishrink.sh -az ${BackupDir}/$(date +%Y-%m-%d).img; fi;
if [ $TEST != true ]; then source /opt/idssys/pibackup/pishrink.sh -az ${BackupDir}/$(date +%Y-%m-%d).img; fi;
echo "$(date) - PiShrink complete"
if [ TEST != true ]; then sleep 1m; fi;
if [ $TEST != true ]; then sleep 1m; fi;
echo "$(date) - Removing old backups..."
allfiles=`ls -1 ${BackupDir}/*.img.gz`
@@ -57,7 +57,7 @@ if [ "$1" != "update" ]; then
done;
if [ $keep == 0 ]; then
echo "$(date) - REMOVING : $i"
#if [ TEST != true ]; then rm -rf $i; fi;
#if [ $TEST != true ]; then rm -rf $i; fi;
else
echo "$(date) - KEEPING : $i"
fi