From f4179e0cdf7cbb88dd0798ded0ee90a8aedcbc9a Mon Sep 17 00:00:00 2001 From: "D. Domig" Date: Sat, 8 Jul 2023 12:08:56 +0200 Subject: [PATCH 1/2] Improve stop handling --- src/entrypoint.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/entrypoint.sh b/src/entrypoint.sh index bf8a425..88a5c0f 100755 --- a/src/entrypoint.sh +++ b/src/entrypoint.sh @@ -16,6 +16,13 @@ add_cfg() { echo "${1}" >>${FILE_CONFIG} } +handle_exit() { + log "Exit signal received, shutting down ..." + exit ${?} +} + +trap 'kill ${!}; handle_exit' SIGHUP SIGINT SIGQUIT SIGTERM + log "xjokay/ccu-historian ${VERSION}" if [[ ! -d "${PATH_CONFIG}" ]]; then From 0d5b4db58e9ea47465d93cccdf0e6742f68c2c73 Mon Sep 17 00:00:00 2001 From: "D. Domig" Date: Mon, 24 Jul 2023 07:26:10 +0200 Subject: [PATCH 2/2] Improve stop handling --- CHANGELOG.md | 10 +++++++++- src/entrypoint.sh | 15 ++++----------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 915aea0..4804304 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [TBA](https://github.com/jokay/docker-ccu-historian/releases/tag/TBA) (TBA) + +### Improvements + +- Improved stop handling. (thx to [@Vrumf0ndel](https://github.com/Vrumf0ndel)) + ([#318]) + ## [3.3.1](https://github.com/jokay/docker-ccu-historian/releases/tag/3.3.1) (2023-03-24) This release contains CCU-Historian [3.3.1](https://github.com/mdzio/ccu-historian/releases/tag/3.3.1). @@ -98,7 +105,7 @@ data. ([#10]) ### Improvements - Exposed additional ports `8082` (Database Web-GUI Port), `9092` (Database TCP -Port) and `5435` (Database PostgreSQL Port). ([#13]) + Port) and `5435` (Database PostgreSQL Port). ([#13]) ## 2.4.0 (2020-06-11) @@ -140,3 +147,4 @@ This release contained CCU-Historian [2.2.0](https://github.com/mdzio/ccu-histor [#29]: https://github.com/jokay/docker-ccu-historian/issues/29 [#140]: https://github.com/jokay/docker-ccu-historian/issues/140 [#148]: https://github.com/jokay/docker-ccu-historian/issues/148 +[#318]: https://github.com/jokay/docker-ccu-historian/issues/318 diff --git a/src/entrypoint.sh b/src/entrypoint.sh index 88a5c0f..953bced 100755 --- a/src/entrypoint.sh +++ b/src/entrypoint.sh @@ -16,13 +16,6 @@ add_cfg() { echo "${1}" >>${FILE_CONFIG} } -handle_exit() { - log "Exit signal received, shutting down ..." - exit ${?} -} - -trap 'kill ${!}; handle_exit' SIGHUP SIGINT SIGQUIT SIGTERM - log "xjokay/ccu-historian ${VERSION}" if [[ ! -d "${PATH_CONFIG}" ]]; then @@ -81,17 +74,17 @@ if [ -n "${CONFIG_KEEP_MONTHS}" ]; then log "Running database maintenance 'clean' (removes all data before ${REF_DATE}) ..." # shellcheck disable=SC2086 - java ${CONFIG_JAVA_OPTS} -jar "${PATH_BASE}/ccu-historian.jar" -config "${FILE_CONFIG}" -clean "${REF_DATE}" + exec java ${CONFIG_JAVA_OPTS} -jar "${PATH_BASE}/ccu-historian.jar" -config "${FILE_CONFIG}" -clean "${REF_DATE}" fi if [[ -n "${CONFIG_KEEP_MONTHS}" || "${CONFIG_MAINTENANCE}" == "true" ]]; then log "Running database maintenance 'recalc' ..." # shellcheck disable=SC2086 - java ${CONFIG_JAVA_OPTS} -jar "${PATH_BASE}/ccu-historian.jar" -config "${FILE_CONFIG}" -recalc + exec java ${CONFIG_JAVA_OPTS} -jar "${PATH_BASE}/ccu-historian.jar" -config "${FILE_CONFIG}" -recalc log "Running database maintenance 'compact' ..." # shellcheck disable=SC2086 - java ${CONFIG_JAVA_OPTS} -jar "${PATH_BASE}/ccu-historian.jar" -config "${FILE_CONFIG}" -compact + exec java ${CONFIG_JAVA_OPTS} -jar "${PATH_BASE}/ccu-historian.jar" -config "${FILE_CONFIG}" -compact fi log "Starting CCU-Historian using the following config:" @@ -102,4 +95,4 @@ done <"${FILE_CONFIG}" log_sub "---" # shellcheck disable=SC2086 -java ${CONFIG_JAVA_OPTS} -jar "${PATH_BASE}/ccu-historian.jar" -config "${FILE_CONFIG}" +exec java ${CONFIG_JAVA_OPTS} -jar "${PATH_BASE}/ccu-historian.jar" -config "${FILE_CONFIG}"