Skip to content

Commit

Permalink
check for safety backup existing
Browse files Browse the repository at this point in the history
  • Loading branch information
simylein committed Jan 9, 2021
1 parent b5cee27 commit 7f3df10
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
7 changes: 7 additions & 0 deletions reset.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,13 @@ echo -e "${green}server successfully stopped!${nocolor}"
echo -e "${blue}backing up...${nocolor}"
cp -r ${serverdirectory}/world ${backupdirectory}/cached/reset-${newdaily}-${newhourly}

# check if safety backup exists
if ! [ -d "${backupdirectory}/cached/reset-${newdaily}-${newhourly}" ]; then
echo -e "${red}fatal: safety backup failed - can not proceed to remove world"
echo "fatal: safety backup failed - can not proceed to remove world" >> ${screenlog}
exit 1
fi

# remove log and world
echo -e "${red}removing world directory...${nocolor}"
rm -r world
Expand Down
5 changes: 5 additions & 0 deletions update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ fi
echo -e "${blue}backing up...${nocolor}"
cp -r ${serverdirectory}/world ${backupdirectory}/cached/update-${newdaily}-${newhourly}

# check if safety backup exists
if ! [ -d "${backupdirectory}/cached/reset-${newdaily}-${newhourly}" ]; then
echo -e "${red}warning: safety backup failed - proceeding to server update"
echo "warning: safety backup failed - proceeding to server update" >> ${screenlog}
fi

# Test internet connectivity and update on success
wget --spider --quiet https://launcher.mojang.com/v1/objects/35139deedbd5182953cf1caa23835da59ca3d7cd/server.jar
Expand Down

0 comments on commit 7f3df10

Please sign in to comment.