- Added all seven issued service trees without omissions. - Preserved the supplied runtime configuration, binaries, and assets.
17 lines
450 B
Bash
Executable File
17 lines
450 B
Bash
Executable File
#!/bin/sh
|
|
set -eu
|
|
|
|
: "${PGHOST:=postgres}"
|
|
: "${PGUSER:=postgres}"
|
|
: "${PGDATABASE:=delamain}"
|
|
: "${PGPASSWORD:=postgres}"
|
|
: "${CLEAN_OLDER_THAN:=6 minutes}"
|
|
: "${CLEAN_EVERY:=60}"
|
|
export PGHOST PGUSER PGDATABASE PGPASSWORD
|
|
|
|
while true; do
|
|
sleep "$CLEAN_EVERY"
|
|
psql -c "DELETE FROM trips WHERE created_at < now() - interval '${CLEAN_OLDER_THAN}'"
|
|
psql -c "DELETE FROM users WHERE created_at < now() - interval '${CLEAN_OLDER_THAN}'"
|
|
done
|