mirror of
https://github.com/tiredofit/docker-db-backup.git
synced 2025-12-21 21:33:28 +01:00
Add sanity checks for Post scripts to be executible
This commit is contained in:
@@ -543,17 +543,24 @@ post_dbbackup() {
|
|||||||
|
|
||||||
### Post Script Support
|
### Post Script Support
|
||||||
if [ -n "${POST_SCRIPT}" ] ; then
|
if [ -n "${POST_SCRIPT}" ] ; then
|
||||||
print_notice "Found POST_SCRIPT environment variable. Executing '${POST_SCRIPT}"
|
if [ -x "${POST_SCRIPT}" ] ; then
|
||||||
eval "${POST_SCRIPT}" "${exit_code}" "${dbtype}" "${dbhost}" "${1}" "${dbbackup_start_time}" "${dbbackup_finish_time}" "${dbbackup_total_time}" "${target}" "${FILESIZE}" "${checksum_value}"
|
print_notice "Found POST_SCRIPT environment variable. Executing '${POST_SCRIPT}"
|
||||||
|
eval "${POST_SCRIPT}" "${exit_code}" "${dbtype}" "${dbhost}" "${1}" "${dbbackup_start_time}" "${dbbackup_finish_time}" "${dbbackup_total_time}" "${target}" "${FILESIZE}" "${checksum_value}"
|
||||||
|
else
|
||||||
|
print_error "Can't execute POST_SCRIPT environment variable '${POST_SCRIPT}' as its filesystem bit is not executible!"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
### Post Backup Custom Script Support
|
### Post Backup Custom Script Support
|
||||||
if [ -d "/assets/custom-scripts/" ] ; then
|
if [ -d "/assets/custom-scripts/" ] ; then
|
||||||
print_notice "Found Post Backup Custom Script to execute"
|
|
||||||
for f in $(find /assets/custom-scripts/ -name \*.sh -type f); do
|
for f in $(find /assets/custom-scripts/ -name \*.sh -type f); do
|
||||||
print_notice "Running Script: '${f}'"
|
if [ -x "${f}" ] ; then
|
||||||
## script EXIT_CODE DB_TYPE DB_HOST DB_NAME STARTEPOCH FINISHEPOCH DURATIONEPOCH BACKUP_FILENAME FILESIZE CHECKSUMVALUE
|
print_notice "Executing post backup custom script : '${f}'"
|
||||||
${f} "${exit_code}" "${dbtype}" "${dbhost}" "${1}" "${dbbackup_start_time}" "${dbbackup_finish_time}" "${dbbackup_total_time}" "${target}" "${FILESIZE}" "${checksum_value}"
|
## script EXIT_CODE DB_TYPE DB_HOST DB_NAME STARTEPOCH FINISHEPOCH DURATIONEPOCH BACKUP_FILENAME FILESIZE CHECKSUMVALUE
|
||||||
|
${f} "${exit_code}" "${dbtype}" "${dbhost}" "${1}" "${dbbackup_start_time}" "${dbbackup_finish_time}" "${dbbackup_total_time}" "${target}" "${FILESIZE}" "${checksum_value}"
|
||||||
|
else
|
||||||
|
print_error "Can't run post backup custom script: '${f}' as its filesystem bit is not executible!"
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user