summaryrefslogtreecommitdiff
path: root/tools/purge.sh
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2021-07-01 13:05:41 +0200
committerTor Andersson <tor@ccxvii.net>2021-07-01 13:09:28 +0200
commitbe5c5e87a8bac59000b503c227e181ead6760540 (patch)
tree3030f4b99f70baf5ca6ce8acc32e24fc54043feb /tools/purge.sh
parent296526198f9ed83c2f5d92cfac57b88856fe8c26 (diff)
downloadserver-be5c5e87a8bac59000b503c227e181ead6760540.tar.gz
Print list of timed out games that are being deleted and abandoned.
Diffstat (limited to 'tools/purge.sh')
-rw-r--r--tools/purge.sh12
1 files changed, 10 insertions, 2 deletions
diff --git a/tools/purge.sh b/tools/purge.sh
index 58e1431..a47bcdd 100644
--- a/tools/purge.sh
+++ b/tools/purge.sh
@@ -2,5 +2,13 @@
# Clean out stale games from the database.
-sqlite3 db "DELETE FROM games WHERE status = 0 AND mtime < datetime('now', '-7 days')"
-sqlite3 db "UPDATE games SET status = 3 WHERE status = 1 AND mtime < datetime('now', '-14 days')"
+WHERE_TIMEOUT_OPEN="WHERE status = 0 AND mtime < datetime('now', '-7 days')"
+WHERE_TIMEOUT_ACTIVE="WHERE status = 1 AND mtime < datetime('now', '-14 days')"
+
+echo "--- TIMED OUT OPEN GAMES ---"
+sqlite3 db "SELECT * FROM game_view $WHERE_TIMEOUT_OPEN"
+sqlite3 db "DELETE FROM games $WHERE_TIMEOUT_OPEN"
+
+echo "--- TIMED OUT ACTIVE GAMES ---"
+sqlite3 db "SELECT * FROM game_view $WHERE_TIMEOUT_ACTIVE"
+sqlite3 db "UPDATE games SET status = 3 $WHERE_TIMEOUT_ACTIVE"