#!/bin/bash
+# This script dumps the database, deletes the database, loads the database, dumps it again...
+# ...and then compares the two dumps to see if we have full fidelity between them.
+#
+# Did you read that correctly? Yes, it will DELETE your database. So don't run this.
+
+
+if [ "${YES_DELETE_MY_DATABASE}" != '' ] ; then
+ echo Ah, I see you have set YES_DELETE_MY_DATABASE to a non-empty value.
+ echo The dump and load test will now proceed.
+else
+ echo 'This script dumps the database, deletes the database, loads the database, dumps it again...'
+ echo '...and then compares the two dumps to see if we have full fidelity between them.'
+ echo 'Did you read that correctly? Yes, it will DELETE your database.'
+ echo 'If this is really what you want, set the environment variable YES_DELETE_MY_DATABASE'
+ echo 'to a non-empty value, and run it again.'
+ exit 0
+fi
+
ps ax | grep citserver | grep -v grep >/dev/null 2>/dev/null && {
- echo dont do this while the server is running
+ echo Do not do this while the server is running.
exit 1
}
./ctdldump -y >dump.dat
first=$(md5sum dump.dat | awk ' { print $1 } ' )
+
rm -fv data/*
./ctdlload -y <dump.dat
./ctdldump -y >dump.dat