mirror of
https://github.com/tiredofit/docker-db-backup.git
synced 2025-12-22 13:44:08 +01:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
005e7f6e47 | ||
|
|
7d7cb9587d | ||
|
|
d1713fe3f0 | ||
|
|
d1e98d9c4b |
7
.github/dependabot.yml
vendored
Normal file
7
.github/dependabot.yml
vendored
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
version: 2
|
||||||
|
updates:
|
||||||
|
# Maintain dependencies for GitHub Actions
|
||||||
|
- package-ecosystem: "github-actions"
|
||||||
|
directory: "/"
|
||||||
|
schedule:
|
||||||
|
interval: "daily"
|
||||||
10
.github/workflows/main.yml
vendored
10
.github/workflows/main.yml
vendored
@@ -13,7 +13,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Prepare
|
- name: Prepare
|
||||||
id: prep
|
id: prep
|
||||||
@@ -63,17 +63,17 @@ jobs:
|
|||||||
echo ::set-output name=docker_image::${DOCKER_IMAGE}
|
echo ::set-output name=docker_image::${DOCKER_IMAGE}
|
||||||
|
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v1
|
uses: docker/setup-qemu-action@v2
|
||||||
with:
|
with:
|
||||||
platforms: all
|
platforms: all
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
id: buildx
|
id: buildx
|
||||||
uses: docker/setup-buildx-action@v1
|
uses: docker/setup-buildx-action@v2
|
||||||
|
|
||||||
- name: Login to DockerHub
|
- name: Login to DockerHub
|
||||||
if: github.event_name != 'pull_request'
|
if: github.event_name != 'pull_request'
|
||||||
uses: docker/login-action@v1
|
uses: docker/login-action@v2
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKER_USERNAME }}
|
username: ${{ secrets.DOCKER_USERNAME }}
|
||||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
@@ -102,7 +102,7 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
uses: docker/build-push-action@v2
|
uses: docker/build-push-action@v3
|
||||||
with:
|
with:
|
||||||
builder: ${{ steps.buildx.outputs.name }}
|
builder: ${{ steps.buildx.outputs.name }}
|
||||||
context: .
|
context: .
|
||||||
|
|||||||
10
.github/workflows/manual.yml
vendored
10
.github/workflows/manual.yml
vendored
@@ -13,7 +13,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Prepare
|
- name: Prepare
|
||||||
id: prep
|
id: prep
|
||||||
@@ -63,17 +63,17 @@ jobs:
|
|||||||
echo ::set-output name=docker_image::${DOCKER_IMAGE}
|
echo ::set-output name=docker_image::${DOCKER_IMAGE}
|
||||||
|
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v1
|
uses: docker/setup-qemu-action@v2
|
||||||
with:
|
with:
|
||||||
platforms: all
|
platforms: all
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
id: buildx
|
id: buildx
|
||||||
uses: docker/setup-buildx-action@v1
|
uses: docker/setup-buildx-action@v2
|
||||||
|
|
||||||
- name: Login to DockerHub
|
- name: Login to DockerHub
|
||||||
if: github.event_name != 'pull_request'
|
if: github.event_name != 'pull_request'
|
||||||
uses: docker/login-action@v1
|
uses: docker/login-action@v2
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKER_USERNAME }}
|
username: ${{ secrets.DOCKER_USERNAME }}
|
||||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
@@ -102,7 +102,7 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
uses: docker/build-push-action@v2
|
uses: docker/build-push-action@v3
|
||||||
with:
|
with:
|
||||||
builder: ${{ steps.buildx.outputs.name }}
|
builder: ${{ steps.buildx.outputs.name }}
|
||||||
context: .
|
context: .
|
||||||
|
|||||||
28
CHANGELOG.md
28
CHANGELOG.md
@@ -1,13 +1,33 @@
|
|||||||
## 3.2.6 2022-04-25 <dave at tiredofit dot ca>
|
## 3.3.3 2022-05-24 <dave at tiredofit dot ca>
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- Alpine 3.16 base
|
||||||
|
|
||||||
|
|
||||||
|
## 3.3.2 2022-05-02 <dave at tiredofit dot ca>
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- Add POST_SCRIPT_SKIP_X_VERIFY environment variables to allow for more host compatibility for post scripts
|
||||||
|
|
||||||
|
|
||||||
|
## 3.3.1 2022-04-30 <dave at tiredofit dot ca>
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- Stop throwing error trying to move blank file if checksums are not enabled
|
- Compressing silently was causing 0 byte backups
|
||||||
|
|
||||||
|
|
||||||
## 3.2.5 2022-04-23 <dave at tiredofit dot ca>
|
## 3.3.0 2022-04-30 <dave at tiredofit dot ca>
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- Ability to auto clean old S3 / Minio Hosts like what occurs on filesysten
|
||||||
|
- Alert user how to turn off Zabbix Monitoring if fails
|
||||||
|
- Allow Zabbix Monitoring to work with S3
|
||||||
|
- Silence some more compression statements
|
||||||
### Changed
|
### Changed
|
||||||
- Fix for restore still not working with DB_PORT variable
|
- Fix for Redis not backing up properly
|
||||||
|
- Start sending checksums for S3 Outputs
|
||||||
|
- Cleanup some code functions
|
||||||
|
- FIx Container Log Level always in DEBUG
|
||||||
|
|
||||||
|
|
||||||
## 3.2.4 2022-04-21 <dave at tiredofit dot ca>
|
## 3.2.4 2022-04-21 <dave at tiredofit dot ca>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
FROM docker.io/tiredofit/alpine:3.15
|
FROM docker.io/tiredofit/alpine:3.16
|
||||||
LABEL maintainer="Dave Conroy (github.com/tiredofit)"
|
LABEL maintainer="Dave Conroy (github.com/tiredofit)"
|
||||||
|
|
||||||
### Set Environment Variables
|
### Set Environment Variables
|
||||||
|
|||||||
@@ -261,6 +261,9 @@ Outputs the following on the console:
|
|||||||
|
|
||||||
If you wish to change the size value from bytes to megabytes set environment variable `SIZE_VALUE=megabytes`
|
If you wish to change the size value from bytes to megabytes set environment variable `SIZE_VALUE=megabytes`
|
||||||
|
|
||||||
|
You must make your scripts executible otherwise there is an internal check that will skip trying to run it otherwise.
|
||||||
|
If for some reason your filesystem or host is not detecting it right, use the environment variable `POST_SCRIPT_SKIP_X_VERIFY=TRUE` to bypass.
|
||||||
|
|
||||||
## Support
|
## Support
|
||||||
|
|
||||||
These images were built to serve a specific need in a production environment and gradually have had more functionality added based on requests from the community.
|
These images were built to serve a specific need in a production environment and gradually have had more functionality added based on requests from the community.
|
||||||
|
|||||||
@@ -279,7 +279,7 @@ backup_redis() {
|
|||||||
pre_dbbackup
|
pre_dbbackup
|
||||||
print_notice "Dumping Redis - Flushing Redis Cache First"
|
print_notice "Dumping Redis - Flushing Redis Cache First"
|
||||||
target=redis_all_${DB_HOST,,}_${now}.rdb
|
target=redis_all_${DB_HOST,,}_${now}.rdb
|
||||||
echo bgsave | redis-cli -h ${DB_HOST} -p ${DB_PORT} ${REDIS_PASS_STR} --rdb ${TEMP_LOCATION}/${target} ${EXTRA_OPTS}
|
echo bgsave | silent redis-cli -h ${DB_HOST} -p ${DB_PORT} ${REDIS_PASS_STR} --rdb ${TEMP_LOCATION}/${target} ${EXTRA_OPTS}
|
||||||
sleep 10
|
sleep 10
|
||||||
try=5
|
try=5
|
||||||
while [ $try -gt 0 ] ; do
|
while [ $try -gt 0 ] ; do
|
||||||
@@ -287,6 +287,7 @@ backup_redis() {
|
|||||||
ok=$(echo 'info Persistence' | redis-cli -h ${DB_HOST} -p ${DB_PORT} ${REDIS_PASS_STR} | awk '/rdb_last_bgsave_status:ok/{print "ok"}')
|
ok=$(echo 'info Persistence' | redis-cli -h ${DB_HOST} -p ${DB_PORT} ${REDIS_PASS_STR} | awk '/rdb_last_bgsave_status:ok/{print "ok"}')
|
||||||
if [[ "$saved" = "saved" ]] && [[ "$ok" = "ok" ]]; then
|
if [[ "$saved" = "saved" ]] && [[ "$ok" = "ok" ]]; then
|
||||||
print_notice "Redis Backup Complete"
|
print_notice "Redis Backup Complete"
|
||||||
|
exit_code=0
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
try=$((try - 1))
|
try=$((try - 1))
|
||||||
@@ -296,6 +297,7 @@ backup_redis() {
|
|||||||
target_original=${target}
|
target_original=${target}
|
||||||
compression
|
compression
|
||||||
$compress_cmd "${TEMP_LOCATION}/${target_original}"
|
$compress_cmd "${TEMP_LOCATION}/${target_original}"
|
||||||
|
check_exit_code $target
|
||||||
generate_checksum
|
generate_checksum
|
||||||
move_dbbackup
|
move_dbbackup
|
||||||
post_dbbackup all
|
post_dbbackup all
|
||||||
@@ -430,11 +432,31 @@ check_exit_code() {
|
|||||||
cleanup_old_data() {
|
cleanup_old_data() {
|
||||||
if [ -n "${DB_CLEANUP_TIME}" ]; then
|
if [ -n "${DB_CLEANUP_TIME}" ]; then
|
||||||
if [ "${master_exit_code}" != 1 ]; then
|
if [ "${master_exit_code}" != 1 ]; then
|
||||||
|
case "${BACKUP_LOCATION,,}" in
|
||||||
|
"file" | "filesystem" )
|
||||||
print_info "Cleaning up old backups"
|
print_info "Cleaning up old backups"
|
||||||
mkdir -p "${DB_DUMP_TARGET}"
|
mkdir -p "${DB_DUMP_TARGET}"
|
||||||
find "${DB_DUMP_TARGET}"/ -mmin +"${DB_CLEANUP_TIME}" -iname "*" -exec rm {} \;
|
find "${DB_DUMP_TARGET}"/ -mmin +"${DB_CLEANUP_TIME}" -iname "*" -exec rm {} \;
|
||||||
|
;;
|
||||||
|
"s3" | "minio" )
|
||||||
|
print_info "Cleaning up old backups"
|
||||||
|
aws ${PARAM_AWS_ENDPOINT_URL} s3 ls s3://${S3_BUCKET}/${S3_PATH} ${s3_ssl} ${s3_ca_cert} ${S3_EXTRA_OPTS} | grep " DIR " -v | while read -r s3_file; do
|
||||||
|
s3_createdate=$(echo $s3_file | awk {'print $1" "$2'})
|
||||||
|
s3_createdate=$(date -d "$s3_createdate" "+%s")
|
||||||
|
s3_olderthan=$(echo $(( $(date +%s)-${DB_CLEANUP_TIME}*60 )))
|
||||||
|
if [[ $s3_createdate -le $s3_olderthan ]] ; then
|
||||||
|
s3_filename=$(echo $s3_file | awk {'print $4'})
|
||||||
|
if [ $s3_filename != "" ] ; then
|
||||||
|
print_debug "Deleting $s3_filename"
|
||||||
|
silent aws ${PARAM_AWS_ENDPOINT_URL} s3 rm s3://${S3_BUCKET}/${S3_PATH}/${s3_filename} ${s3_ssl} ${s3_ca_cert} ${S3_EXTRA_OPTS}
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
done
|
||||||
|
;;
|
||||||
|
esac
|
||||||
else
|
else
|
||||||
print_info "Skipping Cleaning up old backups because there were errors in backing up"
|
print_error "Skipping Cleaning up old backups because there were errors in backing up"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -446,7 +468,7 @@ compression() {
|
|||||||
|
|
||||||
case "${COMPRESSION,,}" in
|
case "${COMPRESSION,,}" in
|
||||||
gz* )
|
gz* )
|
||||||
compress_cmd="pigz -${COMPRESSION_LEVEL} -p ${PARALLEL_COMPRESSION_THREADS} "
|
compress_cmd="pigz -q -${COMPRESSION_LEVEL} -p ${PARALLEL_COMPRESSION_THREADS} "
|
||||||
compression_type="gzip"
|
compression_type="gzip"
|
||||||
extension=".gz"
|
extension=".gz"
|
||||||
dir_compress_cmd=${compress_cmd}
|
dir_compress_cmd=${compress_cmd}
|
||||||
@@ -454,7 +476,7 @@ compression() {
|
|||||||
target=${target}.gz
|
target=${target}.gz
|
||||||
;;
|
;;
|
||||||
bz* )
|
bz* )
|
||||||
compress_cmd="pbzip2 -${COMPRESSION_LEVEL} -p${PARALLEL_COMPRESSION_THREADS} "
|
compress_cmd="pbzip2 -q -${COMPRESSION_LEVEL} -p${PARALLEL_COMPRESSION_THREADS} "
|
||||||
compression_type="bzip2"
|
compression_type="bzip2"
|
||||||
dir_compress_cmd=${compress_cmd}
|
dir_compress_cmd=${compress_cmd}
|
||||||
extension=".bz2"
|
extension=".bz2"
|
||||||
@@ -470,7 +492,7 @@ compression() {
|
|||||||
target=${target}.xz
|
target=${target}.xz
|
||||||
;;
|
;;
|
||||||
zst* )
|
zst* )
|
||||||
compress_cmd="zstd --rm -${COMPRESSION_LEVEL} -T${PARALLEL_COMPRESSION_THREADS} "
|
compress_cmd="zstd -q -q --rm -${COMPRESSION_LEVEL} -T${PARALLEL_COMPRESSION_THREADS} "
|
||||||
compression_type="zstd"
|
compression_type="zstd"
|
||||||
dir_compress_cmd=${compress_cmd}
|
dir_compress_cmd=${compress_cmd}
|
||||||
extension=".zst"
|
extension=".zst"
|
||||||
@@ -506,7 +528,7 @@ create_archive() {
|
|||||||
print_notice "Creating archive file of '${target_dir}' with tar ${compresion_string}"
|
print_notice "Creating archive file of '${target_dir}' with tar ${compresion_string}"
|
||||||
tar cf - "${TEMP_LOCATION}"/"${target_dir}" | $dir_compress_cmd > "${TEMP_LOCATION}"/"${target_dir}".tar"${extension}"
|
tar cf - "${TEMP_LOCATION}"/"${target_dir}" | $dir_compress_cmd > "${TEMP_LOCATION}"/"${target_dir}".tar"${extension}"
|
||||||
else
|
else
|
||||||
print_warn "Skipping creating archive file because backup did not complete successfully"
|
print_error "Skipping creating archive file because backup did not complete successfully"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -530,13 +552,16 @@ generate_checksum() {
|
|||||||
checksum_value=$(${checksum_command} "${target}" | awk ' { print $1}')
|
checksum_value=$(${checksum_command} "${target}" | awk ' { print $1}')
|
||||||
print_debug "${checksum_extension^^}: ${checksum_value} - ${target}"
|
print_debug "${checksum_extension^^}: ${checksum_value} - ${target}"
|
||||||
else
|
else
|
||||||
print_warn "Skipping Checksum creation because backup did not complete successfully"
|
print_error "Skipping Checksum creation because backup did not complete successfully"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
move_dbbackup() {
|
move_dbbackup() {
|
||||||
if [ "${exit_code}" = "0" ] ; then
|
if [ "${exit_code}" = "0" ] ; then
|
||||||
|
dbbackup_size="$(stat -c%s "${TEMP_LOCATION}"/"${target}")"
|
||||||
|
dbbackup_date="$(date -r "${TEMP_LOCATION}"/"${target}" +'%s')"
|
||||||
|
|
||||||
case "${SIZE_VALUE,,}" in
|
case "${SIZE_VALUE,,}" in
|
||||||
"b" | "bytes" )
|
"b" | "bytes" )
|
||||||
SIZE_VALUE=1
|
SIZE_VALUE=1
|
||||||
@@ -560,9 +585,7 @@ move_dbbackup() {
|
|||||||
"file" | "filesystem" )
|
"file" | "filesystem" )
|
||||||
print_debug "Moving backup to filesystem"
|
print_debug "Moving backup to filesystem"
|
||||||
mkdir -p "${DB_DUMP_TARGET}"
|
mkdir -p "${DB_DUMP_TARGET}"
|
||||||
if var_true "${ENABLE_CHECKSUM}" ;then
|
|
||||||
mv "${TEMP_LOCATION}"/*."${checksum_extension}" "${DB_DUMP_TARGET}"/
|
mv "${TEMP_LOCATION}"/*."${checksum_extension}" "${DB_DUMP_TARGET}"/
|
||||||
fi
|
|
||||||
mv "${TEMP_LOCATION}"/"${target}" "${DB_DUMP_TARGET}"/"${target}"
|
mv "${TEMP_LOCATION}"/"${target}" "${DB_DUMP_TARGET}"/"${target}"
|
||||||
;;
|
;;
|
||||||
"s3" | "minio" )
|
"s3" | "minio" )
|
||||||
@@ -581,17 +604,17 @@ move_dbbackup() {
|
|||||||
|
|
||||||
[[ ( -n "${S3_HOST}" ) ]] && PARAM_AWS_ENDPOINT_URL=" --endpoint-url ${S3_PROTOCOL}://${S3_HOST}"
|
[[ ( -n "${S3_HOST}" ) ]] && PARAM_AWS_ENDPOINT_URL=" --endpoint-url ${S3_PROTOCOL}://${S3_HOST}"
|
||||||
|
|
||||||
aws ${PARAM_AWS_ENDPOINT_URL} s3 cp ${TEMP_LOCATION}/${target} s3://${S3_BUCKET}/${S3_PATH}/${target} ${s3_ssl} ${s3_ca_cert} ${S3_EXTRA_OPTS}
|
silent aws ${PARAM_AWS_ENDPOINT_URL} s3 cp ${TEMP_LOCATION}/${target} s3://${S3_BUCKET}/${S3_PATH}/${target} ${s3_ssl} ${s3_ca_cert} ${S3_EXTRA_OPTS}
|
||||||
unset s3_ssl
|
|
||||||
unset s3_ca_cert
|
|
||||||
if var_true "${ENABLE_CHECKSUM}" ; then
|
if var_true "${ENABLE_CHECKSUM}" ; then
|
||||||
rm -rf "${TEMP_LOCATION}"/*."${checksum_extension}"
|
silent aws ${PARAM_AWS_ENDPOINT_URL} s3 cp ${TEMP_LOCATION}/*.${checksum_extension} s3://${S3_BUCKET}/${S3_PATH}/ ${s3_ssl} ${s3_ca_cert} ${S3_EXTRA_OPTS}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
rm -rf "${TEMP_LOCATION}"/*."${checksum_extension}"
|
||||||
rm -rf "${TEMP_LOCATION}"/"${target}"
|
rm -rf "${TEMP_LOCATION}"/"${target}"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
else
|
else
|
||||||
print_warn "Skipping moving DB Backup to final location because backup did not complete successfully"
|
print_error "Skipping moving DB Backup to final location because backup did not complete successfully"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm -rf "${TEMP_LOCATION}"/*
|
rm -rf "${TEMP_LOCATION}"/*
|
||||||
@@ -611,14 +634,18 @@ post_dbbackup() {
|
|||||||
|
|
||||||
if var_true "${CONTAINER_ENABLE_MONITORING}" ; then
|
if var_true "${CONTAINER_ENABLE_MONITORING}" ; then
|
||||||
print_notice "Sending Backup Statistics to Zabbix"
|
print_notice "Sending Backup Statistics to Zabbix"
|
||||||
silent zabbix_sender -c /etc/zabbix/zabbix_agentd.conf -k dbbackup.size -o "$(stat -c%s "${DB_DUMP_TARGET}"/"${target}")"
|
silent zabbix_sender -c /etc/zabbix/zabbix_agentd.conf -k dbbackup.size -o "${dbbackup_size}"
|
||||||
silent zabbix_sender -c /etc/zabbix/zabbix_agentd.conf -k dbbackup.datetime -o "$(date -r "${DB_DUMP_TARGET}"/"${target}" +'%s')"
|
silent zabbix_sender -c /etc/zabbix/zabbix_agentd.conf -k dbbackup.datetime -o "${dbbackup_date}"
|
||||||
silent zabbix_sender -c /etc/zabbix/zabbix_agentd.conf -k dbbackup.status -o "${exit_code}"
|
silent zabbix_sender -c /etc/zabbix/zabbix_agentd.conf -k dbbackup.status -o "${exit_code}"
|
||||||
silent zabbix_sender -c /etc/zabbix/zabbix_agentd.conf -k dbbackup.backup_duration -o "$(echo $((dbbackup_finish_time-dbbackup_start_time)))"
|
silent zabbix_sender -c /etc/zabbix/zabbix_agentd.conf -k dbbackup.backup_duration -o "$(echo $((dbbackup_finish_time-dbbackup_start_time)))"
|
||||||
|
if [ "$?" != "0" ] ; then print_error "Error sending statistics, consider disabling with 'CONTAINER_ENABLE_MONITORING=FALSE'" ; fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
### Post Script Support
|
### Post Script Support
|
||||||
if [ -n "${POST_SCRIPT}" ] ; then
|
if [ -n "${POST_SCRIPT}" ] ; then
|
||||||
|
if var_true "${POST_SCRIPT_SKIP_X_VERIFY}" ; then
|
||||||
|
eval "${POST_SCRIPT}" "${exit_code}" "${dbtype}" "${DB_HOST}" "${1}" "${dbbackup_start_time}" "${dbbackup_finish_time}" "${dbbackup_total_time}" "${target}" "${FILESIZE}" "${checksum_value}"
|
||||||
|
else
|
||||||
if [ -x "${POST_SCRIPT}" ] ; then
|
if [ -x "${POST_SCRIPT}" ] ; then
|
||||||
print_notice "Found POST_SCRIPT environment variable. Executing '${POST_SCRIPT}"
|
print_notice "Found POST_SCRIPT environment variable. Executing '${POST_SCRIPT}"
|
||||||
eval "${POST_SCRIPT}" "${exit_code}" "${dbtype}" "${DB_HOST}" "${1}" "${dbbackup_start_time}" "${dbbackup_finish_time}" "${dbbackup_total_time}" "${target}" "${FILESIZE}" "${checksum_value}"
|
eval "${POST_SCRIPT}" "${exit_code}" "${dbtype}" "${DB_HOST}" "${1}" "${dbbackup_start_time}" "${dbbackup_finish_time}" "${dbbackup_total_time}" "${target}" "${FILESIZE}" "${checksum_value}"
|
||||||
@@ -626,10 +653,14 @@ post_dbbackup() {
|
|||||||
print_error "Can't execute POST_SCRIPT environment variable '${POST_SCRIPT}' as its filesystem bit is not executible!"
|
print_error "Can't execute POST_SCRIPT environment variable '${POST_SCRIPT}' as its filesystem bit is not executible!"
|
||||||
fi
|
fi
|
||||||
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
|
||||||
for f in $(find /assets/custom-scripts/ -name \*.sh -type f); do
|
for f in $(find /assets/custom-scripts/ -name \*.sh -type f); do
|
||||||
|
if var_true "${POST_SCRIPT_SKIP_X_VERIFY}" ; then
|
||||||
|
${f} "${exit_code}" "${dbtype}" "${DB_HOST}" "${1}" "${dbbackup_start_time}" "${dbbackup_finish_time}" "${dbbackup_total_time}" "${target}" "${FILESIZE}" "${checksum_value}"
|
||||||
|
else
|
||||||
if [ -x "${f}" ] ; then
|
if [ -x "${f}" ] ; then
|
||||||
print_notice "Executing post backup custom script : '${f}'"
|
print_notice "Executing post backup custom script : '${f}'"
|
||||||
## script EXIT_CODE DB_TYPE DB_HOST DB_NAME STARTEPOCH FINISHEPOCH DURATIONEPOCH BACKUP_FILENAME FILESIZE CHECKSUMVALUE
|
## script EXIT_CODE DB_TYPE DB_HOST DB_NAME STARTEPOCH FINISHEPOCH DURATIONEPOCH BACKUP_FILENAME FILESIZE CHECKSUMVALUE
|
||||||
@@ -637,10 +668,13 @@ post_dbbackup() {
|
|||||||
else
|
else
|
||||||
print_error "Can't run post backup custom script: '${f}' as its filesystem bit is not executible!"
|
print_error "Can't run post backup custom script: '${f}' as its filesystem bit is not executible!"
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
print_notice "DB Backup for '${1}' time taken: $(echo ${dbbackup_total_time} | awk '{printf "Hours: %d Minutes: %02d Seconds: %02d", $1/3600, ($1/60)%60, $1%60}')"
|
print_notice "DB Backup for '${1}' time taken: $(echo ${dbbackup_total_time} | awk '{printf "Hours: %d Minutes: %02d Seconds: %02d", $1/3600, ($1/60)%60, $1%60}')"
|
||||||
|
unset s3_ssl
|
||||||
|
unset s3_ca_cert
|
||||||
}
|
}
|
||||||
|
|
||||||
sanity_test() {
|
sanity_test() {
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ source /assets/functions/00-container
|
|||||||
source /assets/functions/10-db-backup
|
source /assets/functions/10-db-backup
|
||||||
source /assets/defaults/10-db-backup
|
source /assets/defaults/10-db-backup
|
||||||
PROCESS_NAME="db-backup"
|
PROCESS_NAME="db-backup"
|
||||||
CONTAINER_LOG_LEVEL=DEBUG
|
|
||||||
|
|
||||||
bootstrap_variables
|
bootstrap_variables
|
||||||
|
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ EOF
|
|||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
"-i" )
|
"-i" )
|
||||||
|
echo "interactive mode"
|
||||||
interactive_mode=true
|
interactive_mode=true
|
||||||
;;
|
;;
|
||||||
* )
|
* )
|
||||||
@@ -640,7 +641,7 @@ EOF
|
|||||||
2 )
|
2 )
|
||||||
while true; do
|
while true; do
|
||||||
read -p "$(echo -e ${clg}** ${cdgy}Enter Value \(${cwh}C${cdgy}\) \| \(${cwh}E${cdgy}\) : ${cwh}${coff}) " q_dbport_menu
|
read -p "$(echo -e ${clg}** ${cdgy}Enter Value \(${cwh}C${cdgy}\) \| \(${cwh}E${cdgy}\) : ${cwh}${coff}) " q_dbport_menu
|
||||||
case "${q_dbport_menu,,}" in
|
case "${q_dbname_menu,,}" in
|
||||||
c* )
|
c* )
|
||||||
counter=1
|
counter=1
|
||||||
q_dbport=" "
|
q_dbport=" "
|
||||||
|
|||||||
Reference in New Issue
Block a user