You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
700 B
Bash
32 lines
700 B
Bash
4 years ago
|
#!/bin/sh -e
|
||
|
|
||
|
DST_DIR=/backups
|
||
|
KEEP_DAYS=28
|
||
4 years ago
|
APP_ROOT=/var/www/html/tt-rss
|
||
4 years ago
|
|
||
|
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
|
||
|
|
||
4 years ago
|
DST_FILE=ttrss-backup-$(date +%Y%m%d).tar.gz
|
||
|
|
||
|
echo backing up tt-rss local directories to $DST_DIR/$DST_FILE...
|
||
|
|
||
|
tar -cz -f $DST_DIR/$DST_FILE $APP_ROOT/*.local \
|
||
|
$APP_ROOT/feed-icons/ \
|
||
|
$APP_ROOT/config.php
|
||
|
|
||
4 years ago
|
echo cleaning up...
|
||
|
|
||
4 years ago
|
find $DST_DIR -type f -name '*.gz' -mtime +$KEEP_DAYS -delete
|
||
4 years ago
|
|
||
|
echo done.
|
||
|
else
|
||
|
echo backup failed: database is not ready.
|
||
|
fi
|