added check_railsserver_available function to postgresql backup
This commit is contained in:
parent
67af06f1f3
commit
f64b1c10b5
@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
function backup {
|
function zammad_backup {
|
||||||
TIMESTAMP="$(date +'%Y%m%d%H%M%S')"
|
TIMESTAMP="$(date +'%Y%m%d%H%M%S')"
|
||||||
|
|
||||||
echo "${TIMESTAMP} - backuping zammad..."
|
echo "${TIMESTAMP} - backuping zammad..."
|
||||||
@ -15,12 +15,17 @@ function backup {
|
|||||||
pg_dump --dbname=postgresql://postgres@zammad-postgresql:5432/zammad_production | gzip > ${BACKUP_DIR}/${TIMESTAMP}_zammad_db.psql.gz
|
pg_dump --dbname=postgresql://postgres@zammad-postgresql:5432/zammad_production | gzip > ${BACKUP_DIR}/${TIMESTAMP}_zammad_db.psql.gz
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ "$1" = 'zammad-backup' ]; then
|
function check_railsserver_available {
|
||||||
# wait for zammad process coming up
|
# wait for zammad process coming up
|
||||||
until (echo > /dev/tcp/zammad-railsserver/3000) &> /dev/null; do
|
until (echo > /dev/tcp/zammad-railsserver/3000) &> /dev/null; do
|
||||||
echo "backup waiting for zammads railsserver to be ready..."
|
echo "backup waiting for zammads railsserver to be ready..."
|
||||||
sleep 2
|
sleep 2
|
||||||
done
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ "$1" = 'zammad-backup' ]; then
|
||||||
|
|
||||||
|
check_railsserver_available
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
backup
|
backup
|
||||||
@ -31,11 +36,7 @@ if [ "$1" = 'zammad-backup' ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$1" = 'zammad-backup-once' ]; then
|
if [ "$1" = 'zammad-backup-once' ]; then
|
||||||
# wait for zammad process coming up
|
check_railsserver_available
|
||||||
until (echo > /dev/tcp/zammad-railsserver/3000) &> /dev/null; do
|
|
||||||
echo "backup waiting for zammads railsserver to be ready..."
|
|
||||||
sleep 2
|
|
||||||
done
|
|
||||||
|
|
||||||
backup
|
backup
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user