diff options
Diffstat (limited to 'tools/purge.sh')
-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" |