Skip to content

Commit 38bf7a6

Browse files
author
matthias
committed
modifyied stanza-create and locates
1 parent 00082e9 commit 38bf7a6

File tree

4 files changed

+24
-14
lines changed

4 files changed

+24
-14
lines changed

docker/base/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ RUN ${PACKAGER} -y install --nodocs \
2525
less \
2626
openssl \
2727
vim \
28+
glibc-langpack-en \
2829
&& ${PACKAGER} -y clean all ;
2930

3031
#Add PostgreSQL-Repo to Base

launcher/postgres/launch.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ fi
6262

6363
#For Usage of pgBackrest
6464
if [ "$USE_PGBACKREST" = "true" ]; then
65-
CMD="/scripts/patroni_wait.sh -t 3600 -- /scripts/pgbackrest_backup.sh"
65+
CMD="/scripts/patroni_wait.sh -t 3600 -- /scripts/postgres/init_pgbackrest.sh"
6666
if [ "$(id -u)" = "0" ]; then
6767
su postgres -c "PATH=$PATH $CMD" &
6868
else

scripts/pgbackrest_backup.sh

Lines changed: 0 additions & 13 deletions
This file was deleted.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/bash
2+
# Check Structure
3+
echo "Initialise pgBackRest ... "
4+
if [ -d "/home/postgres/pgdata/pgbackrest/log" ]; then
5+
echo "Skip: Folder structure already exists ... "
6+
else
7+
mkdir -p /home/postgres/pgdata/pgbackrest/log
8+
echo "Created: Folder structure was created"
9+
fi
10+
# Create Stanza and run Init-Backup
11+
stanza=$(pgbackrest info --output=json)
12+
if [ "$stanza" == "[]" ]; then
13+
pgbackrest stanza-create --stanza=db
14+
pgbackrest backup --type=full --stanza=db --repo=1
15+
echo "Finished: pgBackRest is ready for use"
16+
else
17+
backupCount=$(pgbackrest info --output=json | jq '.[0].backup'| jq length)
18+
if [ "$backupCount" == "0" ]; then
19+
pgbackrest backup --type=full --stanza=db --repo=1
20+
echo "Finished: pgBackRest is ready for use"
21+
fi
22+
fi

0 commit comments

Comments
 (0)