Skip to content

Commit

Permalink
Add option for reloading an existing dump
Browse files Browse the repository at this point in the history
  • Loading branch information
vmcj committed Oct 19, 2023
1 parent daf57e8 commit 0d431b9
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions sql/dj_setup_database.in
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,38 @@ snapshot-dump)
esac
;;

snapshot-load)
choice=""
if [ -z "$DUMPNAME" ]; then
set -- $(ls $DATABASEDUMPDIR)
ind=0
while true; do
read -p "Which database should be loaded? " db
ind=0
for i in $@; do
if [ "$ind" = "$db" ]; then
choice="$i"
break
fi
: $((ind+=1))
done
if [ -n "$choice" ]; then
break
fi
done
else
choice="${DUMPNAME}.tar.gz"
fi
FILE="$DATABASEDUMPDIR/${choice}"

if [ ! -f "${FILE}" ]
then
echo "Error. File ${FILE} not found"
exit 1
fi

pv "${FILE}" | gunzip | mysql domjudge

*)
echo "Error: Unknown subcommand '$1'"
usage
Expand Down

0 comments on commit 0d431b9

Please sign in to comment.