3 Commits

Author SHA1 Message Date
bel
0421c8b8d9 hopefully fix bad backup 2020-05-15 11:16:40 -06:00
Bel LaPointe
a904244fd2 Delete failed backups 2020-04-15 19:11:51 +00:00
Bel LaPointe
7ccb495a1a Amend backup to clean 2020-04-07 15:43:11 -06:00
6 changed files with 5441 additions and 1 deletions

View File

@@ -43,7 +43,7 @@ COPY --from=builder /pause/pauser /pauser
USER root USER root
### CRON BACKUPS ### CRON BACKUPS
RUN true \ RUN true \
&& echo 'b=$(date +%Y%m%d%H%M%S) && mkdir -p /mnt/save/$b && pg_dump $DATABASE_URL > /mnt/save/$b/pg.dump' > /backup.sh \ && echo 'b=$(date +%Y%m%d%H%M%S); mkdir -p /mnt/save/$b; pg_dump $DATABASE_URL --clean > /mnt/save/$b/pg.dump || (rm -rf /mnt/save/$b; echo "backup failed; deleting $b"; exit 1); if du -sh /mnt/save/$b | grep -i "^[ ]*4.0K"; then rm -rf /mnt/save/$b; echo rm empty backup $b; fi' > /backup.sh \
&& echo 'b=$(find /mnt/save -type f | sort | tail -n 1); if [ -n "$b" ]; then echo restoring $b; psql $DATABASE_URL < "$b"; fi && service postgresql start;' > /restore.sh \ && echo 'b=$(find /mnt/save -type f | sort | tail -n 1); if [ -n "$b" ]; then echo restoring $b; psql $DATABASE_URL < "$b"; fi && service postgresql start;' > /restore.sh \
&& echo '0 4,8,12,16,20 * * * bash /backup.sh >> /var/log/cronj.log 2>&1' > /etc/cron.d/backups \ && echo '0 4,8,12,16,20 * * * bash /backup.sh >> /var/log/cronj.log 2>&1' > /etc/cron.d/backups \
&& echo '' >> /etc/cron.d/backups \ && echo '' >> /etc/cron.d/backups \

1088
tmp/save/20200415125736/pg.dump Executable file

File diff suppressed because one or more lines are too long

1088
tmp/save/20200415125802/pg.dump Executable file

File diff suppressed because one or more lines are too long

1088
tmp/save/20200415125811/pg.dump Executable file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long