fix postgresql backup dir permission error

This commit is contained in:
André Bauer 2017-02-14 18:40:19 +01:00
parent 37e98b1a81
commit 87336810a8

View file

@ -42,7 +42,8 @@ function backup_db () {
if [ "${DB_ADAPTER}" == "mysql2" ]; then if [ "${DB_ADAPTER}" == "mysql2" ]; then
mysqldump --opt --single-transaction -u${DB_USER} -p${DB_PASS} ${DB_NAME} | gzip > ${BACKUP_DIR}/${TIMESTAMP}_zammad_db.mysql.gz mysqldump --opt --single-transaction -u${DB_USER} -p${DB_PASS} ${DB_NAME} | gzip > ${BACKUP_DIR}/${TIMESTAMP}_zammad_db.mysql.gz
elif [ "${DB_ADAPTER}" == "postgresql" ]; then elif [ "${DB_ADAPTER}" == "postgresql" ]; then
su -c "pg_dump -c ${DB_NAME} | gzip > ${BACKUP_DIR}/${TIMESTAMP}_zammad_db.psql.gz" postgres su -c "pg_dump -c ${DB_NAME} | gzip > /tmp/${TIMESTAMP}_zammad_db.psql.gz" postgres
mv /tmp/${TIMESTAMP}_zammad_db.psql.gz ${BACKUP_DIR}
else else
echo "DB ADAPTER not found. if its sqlite backup is already saved in filebackup" echo "DB ADAPTER not found. if its sqlite backup is already saved in filebackup"
fi fi