X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=mc-core%2Fcontainer_start.sh;fp=mc-core%2Fcontainer_start.sh;h=40008f9e68d3b8219d2d56a52143ed7e7ebdc5d5;hb=3d4b88135c1a1429d8cecb7380cfc2f8c67d04ef;hp=b241ecd774d4acfd7b615f4c32a5f7aba7c6f0c0;hpb=79eb47c2cfd81b81e911e69b67b99c965990f9a2;p=ric-app%2Fmc.git diff --git a/mc-core/container_start.sh b/mc-core/container_start.sh index b241ecd..40008f9 100755 --- a/mc-core/container_start.sh +++ b/mc-core/container_start.sh @@ -25,20 +25,29 @@ # This starts all of the related processes which normally would # be started in individual containers. # -# There are two environment variables which affect the operation +# There are environment variables which affect the operation # of this script: -# USE_NNG -- if set to !0 then the NNG version of the listener -# is started; undefined or when 0 then the SI95 -# version is used. # -# GSLITE_ROOT -- Assumed to be the root directory for the +# GSLITE_ROOT -- Assumed to be the root directory for the # core MC xAPP. If not defined, /mc/gs-lite is # assumed. # +# When NOT running in simulation mode, a registration message is +# sent to the xAPP manager via the registration script in /playpen. +# An unregister message is "queued" and should be sent when this +# script receives a terminating event, or exits normally. +# # Date: 13 February 2019 # Author: E. Scott Daniels # ---------------------------------------------------------------------- +# MUST have a posix style function declaration! +unreg() { + trap - EXIT # prevent running this again when we force the exit + /playpen/bin/xam_register -U + exit +} + set -e FIFO_DIR="/tmp/mcl/fifos" @@ -50,20 +59,22 @@ mkdir -p $FIFO_DIR if [ "$SIMULATOR_MODE" != "true" ] then -# --- start "sidecars" first. They are expected to need /playpen as the working dir + # --- start "sidecars" first. They are expected to need /playpen as the working dir -( - cd /playpen - if [ "$RMR_PORT" != "" ] - then - bin/mc_listener -p $RMR_PORT - else - bin/mc_listener - fi -) >/tmp/listener.std 2>&1 & + ( + cd /playpen + if [ "$RMR_PORT" != "" ] + then + bin/mc_listener -p $RMR_PORT + else + bin/mc_listener + fi + ) >/tmp/listener.std 2>&1 & -echo "listener was started" >&2 + echo "listener was started" >&2 + trap 'unreg' EXIT 1 2 3 4 15 # unregister on exit/hup/quit/term + /playpen/bin/xam_register.sh # register the xapp now that listener is up fi @@ -71,4 +82,3 @@ fi cd ${GSLITE_ROOT:-/mc/gs-lite}/demo/queries ./runall -