diff --git a/containers/zammad-postgresql/backup.sh b/containers/zammad-postgresql/backup.sh index 94eb57c..86852e3 100644 --- a/containers/zammad-postgresql/backup.sh +++ b/containers/zammad-postgresql/backup.sh @@ -1,5 +1,13 @@ #!/bin/bash +function check_railsserver_available { + # wait for zammad process coming up + until (echo > /dev/tcp/zammad-railsserver/3000) &> /dev/null; do + echo "backup waiting for zammads railsserver to be ready..." + sleep 2 + done +} + function zammad_backup { TIMESTAMP="$(date +'%Y%m%d%H%M%S')" @@ -15,14 +23,6 @@ function zammad_backup { pg_dump --dbname=postgresql://postgres@zammad-postgresql:5432/zammad_production | gzip > ${BACKUP_DIR}/${TIMESTAMP}_zammad_db.psql.gz } -function check_railsserver_available { - # wait for zammad process coming up - until (echo > /dev/tcp/zammad-railsserver/3000) &> /dev/null; do - echo "backup waiting for zammads railsserver to be ready..." - sleep 2 - done -} - if [ "$1" = 'zammad-backup' ]; then check_railsserver_available