mirror of
https://0xacab.org/sutty/sutty
synced 2025-02-21 11:41:48 +00:00
calcular bien la fecha
This commit is contained in:
parent
479ca7430f
commit
752935afb4
3 changed files with 7 additions and 4 deletions
|
@ -114,7 +114,7 @@ RUN ln -s data/_private /srv/http/_private
|
||||||
USER root
|
USER root
|
||||||
# Instalar la configuración de monit
|
# Instalar la configuración de monit
|
||||||
RUN install -m 640 -o root -g root /srv/http/monit.conf /etc/monit.d/sutty.conf
|
RUN install -m 640 -o root -g root /srv/http/monit.conf /etc/monit.d/sutty.conf
|
||||||
RUN apk add --no-cache daemonize ruby-webrick
|
RUN apk add --no-cache daemonize ruby-webrick dateutils
|
||||||
RUN install -m 755 /srv/http/entrypoint.sh /usr/local/bin/sutty
|
RUN install -m 755 /srv/http/entrypoint.sh /usr/local/bin/sutty
|
||||||
|
|
||||||
# Mantener estos directorios!
|
# Mantener estos directorios!
|
||||||
|
|
|
@ -47,7 +47,7 @@ class StatCollectionJob < PeriodicJob
|
||||||
def scope
|
def scope
|
||||||
@scope ||= site.build_stats
|
@scope ||= site.build_stats
|
||||||
.jekyll
|
.jekyll
|
||||||
.where('created_at => ?', beginning_of_interval)
|
.where('created_at >= ?', beginning_of_interval)
|
||||||
.group(:site_id)
|
.group(:site_id)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -2,9 +2,12 @@
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
# Volcar y eliminar todos los access logs de dos días atrás
|
# Volcar y eliminar todos los access logs de dos días atrás
|
||||||
date=`bundle exec rails runner "puts (Date.today - 2.days)"`
|
date="`dateadd today -1d`"
|
||||||
|
file="/srv/http/_storage/${date}.psql.gz"
|
||||||
|
test -n "${date}"
|
||||||
|
test ! -f "${file}"
|
||||||
|
|
||||||
psql -h postgresql "${DATABASE:-sutty}" sutty <<SQL | gzip > "/srv/http/_storage/${date}.psql.gz"
|
psql -h postgresql "${DATABASE:-sutty}" sutty <<SQL | gzip > "${file}"
|
||||||
begin;
|
begin;
|
||||||
copy (select * from access_logs where created_at < '${date}') to stdout;
|
copy (select * from access_logs where created_at < '${date}') to stdout;
|
||||||
delete from access_logs where created_at < '${date}';
|
delete from access_logs where created_at < '${date}';
|
||||||
|
|
Loading…
Reference in a new issue