mirror of
https://github.com/itiligent/Easy-Guacamole-Installer.git
synced 2025-12-13 18:02:32 +00:00
fix backup retention issue #32
This commit is contained in:
parent
48fc312043
commit
b86ef4213f
1 changed files with 3 additions and 4 deletions
|
|
@ -30,7 +30,7 @@ BACKUP_EMAIL=
|
||||||
BACKUP_RETENTION=
|
BACKUP_RETENTION=
|
||||||
|
|
||||||
# Protect disk space and remove backups older than {BACKUP_RETENTION} days
|
# 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
|
# Backup code
|
||||||
mkdir -p ${DB_BACKUP_DIR}
|
mkdir -p ${DB_BACKUP_DIR}
|
||||||
|
|
@ -43,8 +43,8 @@ mysqldump -h ${MYSQL_HOST} \
|
||||||
-u ${GUAC_USER} \
|
-u ${GUAC_USER} \
|
||||||
-p"${GUAC_PWD}" \
|
-p"${GUAC_PWD}" \
|
||||||
${GUAC_DB} \
|
${GUAC_DB} \
|
||||||
--single-transaction --quick --lock-tables=false >${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
|
SQLFILE=${DB_BACKUP_DIR}/${GUAC_DB}-${TODAY}.sql
|
||||||
if [[ $? -ne 0 ]]; then
|
if [[ $? -ne 0 ]]; then
|
||||||
echo -e "${LRED}Backup failed.${GREY}" 1>&2
|
echo -e "${LRED}Backup failed.${GREY}" 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
|
|
@ -59,7 +59,6 @@ if [[ $? -ne 0 ]]; then
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
echo -e "${LGREEN}${GUAC_DB} backup was successfully copied to ${DB_BACKUP_DIR}"
|
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}
|
echo "${GUAC_DB} backup was successfully copied to $DB_BACKUP_DIR" | mailx -s "Guacamole backup " ${BACKUP_EMAIL}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue