add backups
This commit is contained in:
parent
23cfeec405
commit
7f1e203bdb
2 changed files with 17 additions and 1 deletions
15
bin/lamassu-backup-pg
Executable file
15
bin/lamassu-backup-pg
Executable file
|
|
@ -0,0 +1,15 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
if [ "$(whoami)" != "postgres" ]; then
|
||||||
|
echo -e "This script has to be run as \033[1mpostgres\033[0m user"
|
||||||
|
exit 3
|
||||||
|
fi
|
||||||
|
|
||||||
|
DAYS_TO_KEEP=3
|
||||||
|
DATE=$(date --utc +%F_%H-%M)
|
||||||
|
BACKUP_DIR=/var/backups/postgresql
|
||||||
|
BACKUP_FILE=$BACKUP_DIR/backup-$DATE.sql.gz
|
||||||
|
|
||||||
|
pg_dump -- lamassu | gzip > $BACKUP_FILE
|
||||||
|
find $BACKUP_DIR -maxdepth 1 -mtime +$DAYS_TO_KEEP -exec rm -f '{}' ';'
|
||||||
|
|
@ -52,7 +52,8 @@
|
||||||
"lamassu-domain": "./bin/lamassu-domain",
|
"lamassu-domain": "./bin/lamassu-domain",
|
||||||
"lamassu-admin-server": "./bin/lamassu-admin-server",
|
"lamassu-admin-server": "./bin/lamassu-admin-server",
|
||||||
"lamassu-apply-defaults": "./bin/lamassu-apply-defaults",
|
"lamassu-apply-defaults": "./bin/lamassu-apply-defaults",
|
||||||
"hkdf": "./bin/hkdf"
|
"hkdf": "./bin/hkdf",
|
||||||
|
"lamassu-backup-pg": "./bin/lamassu-backup-pg"
|
||||||
},
|
},
|
||||||
"scripts": {},
|
"scripts": {},
|
||||||
"devDependencies": {}
|
"devDependencies": {}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue