3 # This script is used to create data snapshots that don't disclose any
4 # identifying player or server information.
6 psql -U xonstat -h localhost xonstatdb <<EOF
7 -- remove email addresses
8 update players set email_addr = NULL where email_addr IS NOT NULL;
10 -- sanitize the server hashkeys
11 update servers set hashkey = server_id where hashkey IS NOT NULL;
13 -- create a sequence to sanitize the player hashkeys
14 create sequence sanitize_seq;
16 -- sanitize all player hashkeys
17 update hashkeys set hashkey = nextval('sanitize_seq');
19 -- get rid of the sequence
20 drop sequence sanitize_seq;
23 # create a backup of the database
24 DATE=$(/bin/date +'%Y%m%d')
26 # backup to a compressed file loadable by the "drop_and_load.shl" script
27 pg_dump -c -U xonstat -h localhost -n xonstat --format=custom --compress=9
28 xonstatdb > ${DATE}_xonstatdb_snapshot.dmp