fix backup retention issue #32

This commit is contained in:
Itiligent 2024-02-22 11:13:39 +11:00
parent 48fc312043
commit b86ef4213f

View file

@ -30,7 +30,7 @@ BACKUP_EMAIL=
BACKUP_RETENTION=
# Protect disk space and remove backups older than {BACKUP_RETENTION} days
find ${DB_BACKUP_DIR} -mtime +${BACKUP_RETENTION} -delete
find ${DB_BACKUP_DIR} -type f -name "*.gz" -mtime +${BACKUP_RETENTION} -delete
# Backup code
mkdir -p ${DB_BACKUP_DIR}
@ -43,8 +43,8 @@ mysqldump -h ${MYSQL_HOST} \
-u ${GUAC_USER} \
-p"${GUAC_PWD}" \
${GUAC_DB} \
--single-transaction --quick --lock-tables=false >${DB_BACKUP_DIR}${GUAC_DB}-${TODAY}.sql
SQLFILE=${DB_BACKUP_DIR}${GUAC_DB}-${TODAY}.sql
--single-transaction --quick --lock-tables=false >${DB_BACKUP_DIR}/${GUAC_DB}-${TODAY}.sql
SQLFILE=${DB_BACKUP_DIR}/${GUAC_DB}-${TODAY}.sql
if [[ $? -ne 0 ]]; then
echo -e "${LRED}Backup failed.${GREY}" 1>&2
exit 1
@ -59,7 +59,6 @@ if [[ $? -ne 0 ]]; then
exit 1
else
echo -e "${LGREEN}${GUAC_DB} backup was successfully copied to ${DB_BACKUP_DIR}"
#mailx -s "Guacamomle Database Backup Success" ${BACKUP_EMAIL}
echo "${GUAC_DB} backup was successfully copied to $DB_BACKUP_DIR" | mailx -s "Guacamole backup " ${BACKUP_EMAIL}
fi