diff options
author | Tor Andersson <tor@ccxvii.net> | 2021-07-01 13:05:41 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2021-07-01 13:09:28 +0200 |
commit | be5c5e87a8bac59000b503c227e181ead6760540 (patch) | |
tree | 3030f4b99f70baf5ca6ce8acc32e24fc54043feb | |
parent | 296526198f9ed83c2f5d92cfac57b88856fe8c26 (diff) | |
download | server-be5c5e87a8bac59000b503c227e181ead6760540.tar.gz |
Print list of timed out games that are being deleted and abandoned.
-rw-r--r-- | tools/purge.sh | 12 |
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" |