aboutsummaryrefslogtreecommitdiffstats
path: root/sources/hv-collector-main/src/main/scripts
diff options
context:
space:
mode:
authorPiotr Jaszczyk <piotr.jaszczyk@nokia.com>2019-01-08 11:00:41 +0100
committerPiotr Jaszczyk <piotr.jaszczyk@nokia.com>2019-01-08 13:15:47 +0100
commit0d3d921285f397239e739790bf62d1cb8768ca7b (patch)
tree4f4005dd58970e0f5c4a30d5c408f773182ce6aa /sources/hv-collector-main/src/main/scripts
parent8b4e282df3863042c69dae60460ec2397e12562e (diff)
Handle sigterm signal
Change-Id: If6f431bfdc42f8d53497078b18813147cad1bad0 Issue-ID: DCAEGEN2-1065 Signed-off-by: Piotr Jaszczyk <piotr.jaszczyk@nokia.com>
Diffstat (limited to 'sources/hv-collector-main/src/main/scripts')
-rwxr-xr-xsources/hv-collector-main/src/main/scripts/entry.sh17
1 files changed, 16 insertions, 1 deletions
diff --git a/sources/hv-collector-main/src/main/scripts/entry.sh b/sources/hv-collector-main/src/main/scripts/entry.sh
index 2e8cb0c5..a612e393 100755
--- a/sources/hv-collector-main/src/main/scripts/entry.sh
+++ b/sources/hv-collector-main/src/main/scripts/entry.sh
@@ -2,4 +2,19 @@
set -euo pipefail
-java ${JAVA_OPTS:-''} -cp '*:' org.onap.dcae.collectors.veshv.main.MainKt $@
+pid=-1
+
+function handle_sigterm() {
+ if [[ ${pid} -ge 0 ]]; then
+ echo "Caught SIGTERM signal. Redirecting to process with pid=${pid}"
+ kill -TERM "${pid}"
+ wait ${pid}
+ fi
+ exit 143 # 128 + 15 -- SIGTERM
+}
+trap "handle_sigterm" SIGTERM
+
+java ${JAVA_OPTS:-} -cp '*:' org.onap.dcae.collectors.veshv.main.MainKt $@ &
+pid=$!
+echo "Service started with pid=${pid}"
+wait ${pid}