From dafeafa4c6973215eb75b77e22e79b58f58306d6 Mon Sep 17 00:00:00 2001 From: flaviomu Date: Wed, 29 Nov 2017 16:31:14 +0100 Subject: [PATCH 1/2] Fix: fix the check for openbaton existing screens If host user is called "openbaton" previous grep does not work --- generic-vnfm.sh | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/generic-vnfm.sh b/generic-vnfm.sh index 30d9e7c7..f3b28577 100755 --- a/generic-vnfm.sh +++ b/generic-vnfm.sh @@ -6,6 +6,7 @@ _openbaton_base="/opt/openbaton" _generic_base="${_openbaton_base}/generic-vnfm" _openbaton_config_file="/etc/openbaton/openbaton-vnfm-generic.properties" _version=${version} +_screen_session_name="openbaton" _screen_name="generic-vnfm" @@ -72,7 +73,7 @@ function start { fi check_rabbitmq check_already_running - screen_exists=$(screen -ls | grep openbaton | wc -l); + screen_exists=$(screen -ls | grep "\.${_screen_session_name}" | wc -l); if [ "${screen_exists}" -eq "0" ]; then if [ -f ${_openbaton_config_file} ]; then @@ -80,28 +81,28 @@ function start { java -jar "${_generic_base}/build/libs/generic-vnfm-${_version}.jar" --spring.config.location=file:${_openbaton_config_file} else echo "Starting the Generic-VNFM in a new screen session (attach to the screen with screen -x openbaton)" - screen -c screenrc -d -m -S openbaton -t ${_screen_name} java -jar "${_generic_base}/build/libs/generic-vnfm-${_version}.jar" --spring.config.location=file:${_openbaton_config_file} + screen -c screenrc -d -m -S ${_screen_session_name} -t ${_screen_name} java -jar "${_generic_base}/build/libs/generic-vnfm-${_version}.jar" --spring.config.location=file:${_openbaton_config_file} fi else if [ "${1}" == "true" ]; then java -jar "${_generic_base}/build/libs/generic-vnfm-${_version}.jar" else - screen -c screenrc -d -m -S openbaton -t ${_screen_name} java -jar "${_generic_base}/build/libs/generic-vnfm-${_version}.jar" + screen -c screenrc -d -m -S ${_screen_session_name} -t ${_screen_name} java -jar "${_generic_base}/build/libs/generic-vnfm-${_version}.jar" fi fi else echo "Starting the Generic-VNFM in the existing screen session (attach to the screen with screen -x openbaton)" if [ -f ${_openbaton_config_file} ]; then - screen -S openbaton -X screen -t ${_screen_name} java -jar "${_generic_base}/build/libs/generic-vnfm-${_version}.jar" --spring.config.location=file:${_openbaton_config_file} + screen -S ${_screen_session_name} -X screen -t ${_screen_name} java -jar "${_generic_base}/build/libs/generic-vnfm-${_version}.jar" --spring.config.location=file:${_openbaton_config_file} else - screen -S openbaton -X screen -t ${_screen_name} java -jar "${_generic_base}/build/libs/generic-vnfm-${_version}.jar" + screen -S ${_screen_session_name} -X screen -t ${_screen_name} java -jar "${_generic_base}/build/libs/generic-vnfm-${_version}.jar" fi fi } function stop { - if screen -list | grep "openbaton" > /dev/null ; then - screen -S openbaton -p ${_screen_name} -X stuff '\003' + if screen -list | grep "\.${_screen_session_name}" > /dev/null ; then + screen -S ${_screen_session_name} -p ${_screen_name} -X stuff '\003' fi } From 76ddd185c149a2fc6bd81a0142bd98fc03ebb84c Mon Sep 17 00:00:00 2001 From: flaviomu Date: Mon, 11 Dec 2017 10:34:34 +0100 Subject: [PATCH 2/2] Fix: fix start in fg --- generic-vnfm.sh | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/generic-vnfm.sh b/generic-vnfm.sh index f3b28577..5455e18a 100755 --- a/generic-vnfm.sh +++ b/generic-vnfm.sh @@ -6,6 +6,7 @@ _openbaton_base="/opt/openbaton" _generic_base="${_openbaton_base}/generic-vnfm" _openbaton_config_file="/etc/openbaton/openbaton-vnfm-generic.properties" _version=${version} +_version="5.1.1-SNAPSHOT" _screen_session_name="openbaton" _screen_name="generic-vnfm" @@ -73,29 +74,29 @@ function start { fi check_rabbitmq check_already_running - screen_exists=$(screen -ls | grep "\.${_screen_session_name}" | wc -l); - if [ "${screen_exists}" -eq "0" ]; then + if [ "${1}" == "true" ]; then if [ -f ${_openbaton_config_file} ]; then - if [ "${1}" == "true" ]; then - java -jar "${_generic_base}/build/libs/generic-vnfm-${_version}.jar" --spring.config.location=file:${_openbaton_config_file} - else - echo "Starting the Generic-VNFM in a new screen session (attach to the screen with screen -x openbaton)" - screen -c screenrc -d -m -S ${_screen_session_name} -t ${_screen_name} java -jar "${_generic_base}/build/libs/generic-vnfm-${_version}.jar" --spring.config.location=file:${_openbaton_config_file} - fi + java -jar "${_generic_base}/build/libs/generic-vnfm-${_version}.jar" --spring.config.location=file:${_openbaton_config_file} else - if [ "${1}" == "true" ]; then - java -jar "${_generic_base}/build/libs/generic-vnfm-${_version}.jar" - else - screen -c screenrc -d -m -S ${_screen_session_name} -t ${_screen_name} java -jar "${_generic_base}/build/libs/generic-vnfm-${_version}.jar" - fi + java -jar "${_generic_base}/build/libs/generic-vnfm-${_version}.jar" fi else - echo "Starting the Generic-VNFM in the existing screen session (attach to the screen with screen -x openbaton)" - if [ -f ${_openbaton_config_file} ]; then - screen -S ${_screen_session_name} -X screen -t ${_screen_name} java -jar "${_generic_base}/build/libs/generic-vnfm-${_version}.jar" --spring.config.location=file:${_openbaton_config_file} + screen_exists=$(screen -ls | grep "\.${_screen_session_name}" | wc -l); + if [ "${screen_exists}" -eq "0" ]; then + echo "Starting the Generic-VNFM in a new screen session (attach to the screen with screen -x openbaton)" + if [ -f ${_openbaton_config_file} ]; then + screen -c screenrc -d -m -S ${_screen_session_name} -t ${_screen_name} java -jar "${_generic_base}/build/libs/generic-vnfm-${_version}.jar" --spring.config.location=file:${_openbaton_config_file} + else + screen -c screenrc -d -m -S ${_screen_session_name} -t ${_screen_name} java -jar "${_generic_base}/build/libs/generic-vnfm-${_version}.jar" + fi else - screen -S ${_screen_session_name} -X screen -t ${_screen_name} java -jar "${_generic_base}/build/libs/generic-vnfm-${_version}.jar" + echo "Starting the Generic-VNFM in the existing screen session (attach to the screen with screen -x openbaton)" + if [ -f ${_openbaton_config_file} ]; then + screen -S ${_screen_session_name} -X screen -t ${_screen_name} java -jar "${_generic_base}/build/libs/generic-vnfm-${_version}.jar" --spring.config.location=file:${_openbaton_config_file} + else + screen -S ${_screen_session_name} -X screen -t ${_screen_name} java -jar "${_generic_base}/build/libs/generic-vnfm-${_version}.jar" + fi fi fi }