removed double code
This commit is contained in:
parent
b6b0b05889
commit
69a3ed8a66
@ -1,14 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
if [ "$1" = 'zammad-backup' ]; then
|
function backup {
|
||||||
# wait for zammad process coming up
|
TIMESTAMP="$(date +'%Y%m%d%H%M%S')"
|
||||||
until (echo > /dev/tcp/zammad-railsserver/3000) &> /dev/null; do
|
|
||||||
echo "backup waiting for zammads railsserver to be ready..."
|
|
||||||
sleep 2
|
|
||||||
done
|
|
||||||
|
|
||||||
while true; do
|
|
||||||
TIMESTAMP="$(date +'%Y%m%d%H%M%S')"
|
|
||||||
|
|
||||||
echo "${TIMESTAMP} - backuping zammad..."
|
echo "${TIMESTAMP} - backuping zammad..."
|
||||||
|
|
||||||
@ -20,6 +13,17 @@ if [ "$1" = 'zammad-backup' ]; then
|
|||||||
|
|
||||||
#db backup
|
#db 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
|
||||||
|
# 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
|
||||||
|
|
||||||
|
while true; do
|
||||||
|
backup
|
||||||
|
|
||||||
# wait until next backup
|
# wait until next backup
|
||||||
sleep ${BACKUP_SLEEP}
|
sleep ${BACKUP_SLEEP}
|
||||||
@ -33,16 +37,5 @@ if [ "$1" = 'zammad-backup-once' ]; then
|
|||||||
sleep 2
|
sleep 2
|
||||||
done
|
done
|
||||||
|
|
||||||
TIMESTAMP="$(date +'%Y%m%d%H%M%S')"
|
backup
|
||||||
|
|
||||||
echo "${TIMESTAMP} - backuping zammad..."
|
|
||||||
|
|
||||||
# delete old backups
|
|
||||||
test -d ${BACKUP_DIR} && find ${BACKUP_DIR}/*_zammad_*.gz -type f -mtime +${HOLD_DAYS} -exec rm {} \;
|
|
||||||
|
|
||||||
# tar files
|
|
||||||
tar -czf ${BACKUP_DIR}/${TIMESTAMP}_zammad_files.tar.gz ${ZAMMAD_DIR}
|
|
||||||
|
|
||||||
#db backup
|
|
||||||
pg_dump --dbname=postgresql://postgres@zammad-postgresql:5432/zammad_production | gzip > ${BACKUP_DIR}/${TIMESTAMP}_zammad_db.psql.gz
|
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user