Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add signal handling to agbot_start.sh and css_start.sh #4039

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions anax-in-container/script/agbot_start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,19 @@

# Script to start agbot from inside the container

if [ -z "$ANAX_LOG_LEVEL" ]; then
if [ -z "${ANAX_LOG_LEVEL}" ]; then
ANAX_LOG_LEVEL=3
fi

/usr/bin/envsubst < /etc/horizon/anax.json.tmpl > /etc/horizon/anax.json
/usr/horizon/bin/anax -v $ANAX_LOG_LEVEL -logtostderr -config /etc/horizon/anax.json
/usr/horizon/bin/anax -v "${ANAX_LOG_LEVEL}" -logtostderr -config /etc/horizon/anax.json &
ANAX_PID=$!

# If we receive SIGTERM, forward it to anax to start graceful termination
send_sigterm() {
kill "${ANAX_PID}" 2>/dev/null
}
trap send_sigterm TERM

# Wait for anax termination
wait "${ANAX_PID}"
12 changes: 11 additions & 1 deletion css/script/css_start.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
#!/bin/bash

/usr/bin/envsubst < /etc/edge-sync-service/sync.conf.tmpl > /etc/edge-sync-service/sync.conf
/home/cssuser/cloud-sync-service
/home/cssuser/cloud-sync-service &
CSS_PID=$!

# If we receive SIGTERM, forward it to css to start graceful termination
send_sigterm() {
kill "${CSS_PID}" 2>/dev/null
}
trap send_sigterm TERM

# Wait for css termination
wait "${CSS_PID}"
Loading