diff --git a/generic-vnfm.sh b/generic-vnfm.sh index 30d9e7c7..5455e18a 100755 --- a/generic-vnfm.sh +++ b/generic-vnfm.sh @@ -6,6 +6,8 @@ _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" @@ -72,36 +74,36 @@ function start { fi check_rabbitmq check_already_running - screen_exists=$(screen -ls | grep openbaton | 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 openbaton -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 openbaton -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 openbaton -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 openbaton -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 } 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 }