Skip to content

Commit

Permalink
Code formatting and cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
tiredofit committed Nov 5, 2023
1 parent 2b446f1 commit da54cdf
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 72 deletions.
18 changes: 9 additions & 9 deletions install/assets/dbbackup/template-dbbackup/run
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ else
elif [[ "${backup_job_backup_begin}" =~ ([0-9]{4})-([0-9]{2})-([0-9]{2})[[:space:]]([0-9]{2}):([0-9]{2}):([0-9]{2}) ]]; then
print_debug "BACKUP_BEGIN is a full date timestamp"
timer datetime
elif echo ${backup_job_backup_begin//\*/#} | grep -qP "^(((\d+,)+\d+|(\d+(\/|-)\d+)|\d+|#) ?){5}$" ; then
elif echo "${backup_job_backup_begin//\*/#}" | grep -qP "^(((\d+,)+\d+|(\d+(\/|-)\d+)|\d+|#) ?){5}$" ; then
print_debug "BACKUP_BEGIN is a cron expression"
time_last_run=$(date +"%s")
timer cron "${backup_job_backup_begin}" "${time_current}" "${time_last_run}"
Expand All @@ -52,8 +52,8 @@ EOF
fi

print_debug "Wait Time: ${time_wait} Future execution time: ${time_future} Current Time: ${time_current}"
print_info "Next Backup at $(date -d @${time_future} +'%Y-%m-%d %T %Z')"
silent sleep ${time_wait}
print_info "Next Backup at $(date -d @"${time_future}" +'%Y-%m-%d %T %Z')"
silent sleep "${time_wait}"
fi

while true; do
Expand All @@ -75,19 +75,19 @@ while true; do
print_debug "Backup {{BACKUP_NUMBER}} routines started time: $(date +'%Y-%m-%d %T %Z')"
bootstrap_filesystem
check_availability
backup_${dbtype,,}
backup_"${dbtype,,}"
timer job stop
if [ -z "${exitcode_backup}" ] ; then exitcode_backup="0" ; fi
print_info "Backup {{BACKUP_NUMBER}} routines finish time: $(date -d @${backup_job_finish_time} +'%Y-%m-%d %T %Z') with exit code ${exitcode_backup}"
print_notice "Backup {{BACKUP_NUMBER}} routines time taken: $(echo ${backup_job_total_time} | awk '{printf "Hours: %d Minutes: %02d Seconds: %02d", $1/3600, ($1/60)%60, $1%60}')"
print_info "Backup {{BACKUP_NUMBER}} routines finish time: $(date -d @"${backup_job_finish_time}" +'%Y-%m-%d %T %Z') with exit code ${exitcode_backup}"
print_notice "Backup {{BACKUP_NUMBER}} routines time taken: $(echo "${backup_job_total_time}" | awk '{printf "Hours: %d Minutes: %02d Seconds: %02d", $1/3600, ($1/60)%60, $1%60}')"
sed -i "/^{{BACKUP_NUMBER}}/d" /tmp/.container/db-backup-backups
fi

symlink_log

if var_false "${persist}" ; then
print_debug "Exiting due to manual mode"
exit ${exitcode_backup};
exit "${exitcode_backup}";
else
if var_true "${stop_scheduler_backup}" ; then
print_error "Stopping backup_scheduler {{BACKUP_NUMBER}} due to detected errors. Fix and restart container."
Expand All @@ -99,8 +99,8 @@ while true; do
else
time_last_run=$(date +"%s")
timer cron "${backup_job_backup_begin}" "${time_current}" "${time_last_run}"
print_notice "Sleeping for another ${time_wait} seconds. Waking up at $(date -d@${time_future} +'%Y-%m-%d %T %Z') "
silent sleep ${time_wait}
print_notice "Sleeping for another ${time_wait} seconds. Waking up at $(date -d@"${time_future}" +'%Y-%m-%d %T %Z') "
silent sleep "${time_wait}"
fi
fi
fi
Expand Down
Loading

0 comments on commit da54cdf

Please sign in to comment.