added custome cron scripts
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Variables
|
||||
LOCATION="/home/juulk/docker/postgresql"
|
||||
RETENTION=7
|
||||
DATE=$(date +"%Y-%m-%d_%H-%M-%S")
|
||||
FILENAME="backup-$DATE.sql"
|
||||
|
||||
# Dump all databases
|
||||
docker exec -u postgres postgres pg_dumpall > "$LOCATION/$FILENAME"
|
||||
|
||||
# Zip dump
|
||||
gzip "$LOCATION/$FILENAME"
|
||||
|
||||
# Delete old backups
|
||||
find "$LOCATION" -name "backup-*.sql.gz" -type f -mtime +$RETENTION -exec rm {} \;
|
||||
Reference in New Issue
Block a user