5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-07-03 10:56:09 +00:00
panel/bin/access_logs

13 lines
381 B
Plaintext
Raw Normal View History

#!/bin/sh
set -e
# Volcar y eliminar todos los access logs de dos días atrás
date=`bundle exec rails runner "puts (Date.today - 2.days)"`
2022-04-23 19:30:34 +00:00
psql -h postgresql "${DATABASE:-sutty}" sutty <<SQL | gzip > "/srv/_storage/${date}.psql.gz"
begin;
copy (select * from access_logs where created_at < '${date}') to stdout;
delete from access_logs where created_at < '${date}';
commit;
SQL