X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=mc-core%2Fcontainer_start.sh;h=40008f9e68d3b8219d2d56a52143ed7e7ebdc5d5;hb=3d4b88135c1a1429d8cecb7380cfc2f8c67d04ef;hp=a2195eaa25394d969739e67e1edf73404293fcaf;hpb=50db50e8785e69eee93a1f79bbe179f26cd6e589;p=ric-app%2Fmc.git diff --git a/mc-core/container_start.sh b/mc-core/container_start.sh index a2195ea..40008f9 100755 --- a/mc-core/container_start.sh +++ b/mc-core/container_start.sh @@ -25,41 +25,56 @@ # 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" + SIMULATOR_MODE=`python /mc/extract_params.py ${XAPP_DESCRIPTOR_PATH}/config-file.json simulator_mode` -RMR_PORT=`python /mc/extract_rmr_port.py ${XAPP_DESCRIPTOR_PATH}/config-file.json rmr_data_in` +RMR_PORT=`python /mc/extract_rmr_port.py ${XAPP_DESCRIPTOR_PATH}/config-file.json rmr-data` + +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 -) + ( + 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 @@ -67,4 +82,3 @@ fi cd ${GSLITE_ROOT:-/mc/gs-lite}/demo/queries ./runall -