fixes on postinstall & backup script

This commit is contained in:
André Bauer 2016-12-11 09:49:57 +01:00
parent 5154afd918
commit 5e6d32699d
3 changed files with 3 additions and 5 deletions

View file

@ -12,7 +12,7 @@ function get_backup_date () {
} }
function delete_old_backups () { function delete_old_backups () {
find ${BACKUP_DIR}/*_zammad_*.gz -maxdepth 2 -mindepth 2 -type f -mtime +${HOLD_DAYS} -exec rm -r \; find ${BACKUP_DIR}/*_zammad_*.gz -type f -mtime +${HOLD_DAYS} -exec rm -r \;
} }
function get_db_credentials () { function get_db_credentials () {
@ -43,7 +43,7 @@ function backup_db () {
mysqldump --opt --single-transaction ${DB_NAME} | gzip > ${BACKUP_DIR}/${TIMESTAMP}_zammad_db.mysql.gz mysqldump --opt --single-transaction ${DB_NAME} | gzip > ${BACKUP_DIR}/${TIMESTAMP}_zammad_db.mysql.gz
elif [ "${DB_ADAPTER}" == "postgresql" ]; then elif [ "${DB_ADAPTER}" == "postgresql" ]; then
su -c "pg_dump ${DB_NAME} | gzip > ${BACKUP_DIR}/${TIMESTAMP}_zammad_db.psql.gz" postgres su -c "pg_dump ${DB_NAME} | gzip > ${BACKUP_DIR}/${TIMESTAMP}_zammad_db.psql.gz" postgres
else else
echo "ADAPTER not found. if its sqlite backup is already saved in filebackup" echo "ADAPTER not found. if its sqlite backup is already saved in filebackup"
fi fi
} }

View file

@ -17,7 +17,7 @@ delete_old_backups
if [ -f ${ZAMMAD_DIR}/${DATABASE_CONFIG} ]; then if [ -f ${ZAMMAD_DIR}/${DATABASE_CONFIG} ]; then
get_db_credentials get_db_credentials
else else
echo "${ZAMMAD_DIR}//${DATABASE_CONFIG} is missing. is zammad configured yet?" echo "${ZAMMAD_DIR}/${DATABASE_CONFIG} is missing. is zammad configured yet?"
exit 1 exit 1
fi fi

View file

@ -228,5 +228,3 @@ function final_message () {
fi fi
echo -e "####################################################################################" echo -e "####################################################################################"
} }
function