mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-16 10:21:42 +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
|
||||
# Instalar la configuración de monit
|
||||
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
|
||||
|
||||
# Mantener estos directorios!
|
||||
|
|
|
@ -47,7 +47,7 @@ class StatCollectionJob < PeriodicJob
|
|||
def scope
|
||||
@scope ||= site.build_stats
|
||||
.jekyll
|
||||
.where('created_at => ?', beginning_of_interval)
|
||||
.where('created_at >= ?', beginning_of_interval)
|
||||
.group(:site_id)
|
||||
end
|
||||
|
||||
|
|
|
@ -2,9 +2,12 @@
|
|||
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)"`
|
||||
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;
|
||||
copy (select * from access_logs where created_at < '${date}') to stdout;
|
||||
delete from access_logs where created_at < '${date}';
|
||||
|
|
Loading…
Reference in a new issue