Skip to content

Commit

Permalink
restore.sh: refactor: cleanup & simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
ukkopahis committed May 31, 2022
1 parent 36a5f70 commit 0387b75
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions scripts/restore.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,12 @@ if [[ ! $PROCEED_WITH_RESTORE =~ ^[Yy]$ ]]; then
exit 0
fi

RESTOREFILENAME="backup.tar.gz"
RESTOREFILENAME=${1:-$RESTOREFILENAME}
RESTOREFILENAME=${1:-"backup.tar.gz"}

BASEDIR=./backups
TMPDIR=./.tmp
BASERESTOREFILE="$(date +"%Y-%m-%d_%H%M")"
RESTOREFILE="$BASEDIR/$RESTOREFILENAME"
LOGFILE="$BASEDIR/logs/restore_$BASERESTOREFILE.log"
BACKUPFILE="$BASEDIR/backup/backup_$BASERESTOREFILE.tar.gz"
LOGFILE="$BASEDIR/logs/restore_$(date +"%Y-%m-%d_%H%M").log"

[ -d ./backups ] || mkdir -p ./backups
[ -d ./backups/logs ] || mkdir -p ./backups/logs

[ -d ./.tmp ] || sudo rm -rf ./.tmp
Expand Down Expand Up @@ -70,7 +65,6 @@ sudo rm -rf ./postbuild.sh >> $LOGFILE 2>&1
sudo rm -rf ./pre_backup.sh >> $LOGFILE 2>&1
sudo rm -rf ./post_backup.sh >> $LOGFILE 2>&1
sudo rm -rf ./post_restore.sh >> $LOGFILE 2>&1
sudo rm -rf ./post_restore.sh >> $LOGFILE 2>&1

sudo tar -zxvf \
$RESTOREFILE >> $LOGFILE 2>&1
Expand Down

0 comments on commit 0387b75

Please sign in to comment.