-
Notifications
You must be signed in to change notification settings - Fork 41
Expand file tree
/
Copy pathdocker-postgres-s3-backups
More file actions
43 lines (17 loc) · 877 Bytes
/
docker-postgres-s3-backups
File metadata and controls
43 lines (17 loc) · 877 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/bash
#Purpose: Automated Backups of postgres docker
# https://hub.docker.com/r/prodrigestivill/postgres-backup-local
# https://www.tablesgenerator.com/markdown_tables
# https://hub.docker.com/repository/docker/quickbooks2018/postgres-backup-local
BACKUP_S3=`ls -ltr /root/s3/cloudgeeks-backups/postgres/daily | grep ".gz" | awk '{print $9}' | tail -n1`
docker run --network invocom --rm -v "/root/postgres/backups:/backups" -u "$(id -u):$(id -g)" -e POSTGRES_HOST=postgres -e POSTGRES_DB=psotgres -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=postgres prodrigestivill/postgres-backup-local /backup.sh
cp -r /root/postgres/backups/daily /root/s3/cloudgeeks-backups/postgres
rm -rf /root/postgres
for i in $BACKUP_S3
do
sleep 5
rm -f /root/s3/cloudgeeks-backups/postgres/daily/$i
done
# Backup extract
#gunzip -f cloudgeeks-202103.sql.gz
#END