add side container which backups tt-rss database once a week
bump alpine image to 3.12remotes/origin/pgsql-count-bits-12
parent
4b0a057199
commit
b2336cee44
@ -0,0 +1,22 @@
|
|||||||
|
#!/bin/sh -e
|
||||||
|
|
||||||
|
DST_DIR=/backups
|
||||||
|
KEEP_DAYS=28
|
||||||
|
|
||||||
|
if pg_isready -h $DB_HOST -U $DB_USER; then
|
||||||
|
DST_FILE=ttrss-backup-$(date +%Y%m%d).sql.gz
|
||||||
|
|
||||||
|
echo backing up tt-rss database to $DST_DIR/$DST_FILE...
|
||||||
|
|
||||||
|
export PGPASSWORD=$DB_PASS
|
||||||
|
|
||||||
|
pg_dump --clean -h $DB_HOST -U $DB_USER $DB_NAME | gzip > $DST_DIR/$DST_FILE
|
||||||
|
|
||||||
|
echo cleaning up...
|
||||||
|
|
||||||
|
find $DST_DIR -type f -name '*.sql.gz' -mtime +$KEEP_DAYS -delete
|
||||||
|
|
||||||
|
echo done.
|
||||||
|
else
|
||||||
|
echo backup failed: database is not ready.
|
||||||
|
fi
|
@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# https://github.com/dubiousjim/dcron/issues/13
|
||||||
|
set -e
|
||||||
|
|
||||||
|
/usr/sbin/crond "$@"
|
Loading…
Reference in New Issue