mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-26 10:56:22 +00:00
13 lines
339 B
Text
13 lines
339 B
Text
|
#!/bin/sh
|
||
|
set -e
|
||
|
|
||
|
# Volcar y eliminar todos los access logs del día anterior
|
||
|
date=`date +%F`
|
||
|
|
||
|
psql -h postgresql "${DATABASE:-sutty}" sutty <<SQL | gzip > "/srv/http/_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
|