Updated password checks and reinitiate restic
parent
ac5187845d
commit
2a3c7341f0
|
@ -54,10 +54,11 @@ function check_backup_repo() {
|
|||
|
||||
if ! GOGC=20 restic -r "${backup_repo_path}" snapshots > /dev/null 2>&1; then
|
||||
echo "$(date) ${ENV_NAME} ERROR: Repository exists but password does not match." | tee -a "${backup_log_file}"
|
||||
echo "Please reinitialize the repository manually or adjust the password file." | tee -a "${backup_log_file}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "$(date) Reinitializing the repository with a new password." | tee -a "${backup_log_file}"
|
||||
rm -rf "${backup_repo_path}"/*
|
||||
GOGC=20 restic init -r "${backup_repo_path}"
|
||||
echo "$(date) Repository reinitialized with a new password." | tee -a "${backup_log_file}"
|
||||
else
|
||||
# Remove stale lock if exists
|
||||
if [[ $(ls -A "${backup_repo_path}/locks") ]]; then
|
||||
echo "$(date) ${ENV_NAME} Backup repository has a stale lock, removing" | tee -a "${backup_log_file}"
|
||||
|
@ -70,12 +71,14 @@ function check_backup_repo() {
|
|||
echo "Backup repository integrity check failed." | tee -a "${backup_log_file}"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
else
|
||||
echo "$(date) ${ENV_NAME} Initializing new backup repository" | tee -a "${backup_log_file}"
|
||||
GOGC=20 restic init -r "${backup_repo_path}"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
function sendEmailNotification() {
|
||||
if [ -e "/usr/lib/jelastic/modules/api.module" ]; then
|
||||
[ -e "/var/run/jem.pid" ] && return 0;
|
||||
|
|
Loading…
Reference in New Issue