From ef2b53693622feb5635b361e59cbb93d0ffda72a Mon Sep 17 00:00:00 2001 From: David Morin Date: Fri, 22 Dec 2017 17:02:34 +0100 Subject: [PATCH 1/2] start/stop/status: add some controls to make it more reliable --- sensision/src/main/shell/sensision.init | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/sensision/src/main/shell/sensision.init b/sensision/src/main/shell/sensision.init index ebd9aec..432f1c7 100755 --- a/sensision/src/main/shell/sensision.init +++ b/sensision/src/main/shell/sensision.init @@ -325,10 +325,11 @@ start() { # # Start.. # - su "${SENSISION_USER}" -c "${JAVA_HOME}/bin/java -Xmx${SENSISION_HEAP} ${SENSISION_OPTS} -Dsensision.config=${SENSISION_CONFIG} -cp ${SENSISION_CP} ${SENSISION_CLASS} >> ${SENSISION_HOME}/logs/nohup.out 2>&1 & echo $! > ${PID_FILE}" + su "${SENSISION_USER}" -c "${JAVA_HOME}/bin/java -Xmx${SENSISION_HEAP} ${SENSISION_OPTS} -Dsensision.config=${SENSISION_CONFIG} -cp ${SENSISION_CP} ${SENSISION_CLASS} >> ${SENSISION_HOME}/logs/nohup.out 2>&1 & echo \$! > ${PID_FILE}" - if [ ! -e ${PID_FILE} ]; then + if [ ! -e ${PID_FILE} ] || [ "`su \"${SENSISION_USER}\" -c \"${JAVA_HOME}/bin/jps -lm|grep -wE $(cat ${PID_FILE})|cut -f 1 -d' '\"`" == "" ]; then echo "Start failed !" + rm -f ${PID_FILE} exit 1 fi } @@ -336,15 +337,18 @@ start() { stop() { if [ -e ${PID_FILE} ] && [ "`su \"${SENSISION_USER}\" -c \"${JAVA_HOME}/bin/jps -lm|grep -wE $(cat ${PID_FILE})|cut -f 1 -d' '\"`" != "" ]; then kill `su "${SENSISION_USER}" -c "${JAVA_HOME}/bin/jps -lm|grep -wE $(cat ${PID_FILE})|cut -f 1 -d' '"` - rm -f ${PID_FILE} else echo "No instance of Sensision is currently running" fi + rm -f ${PID_FILE} } status() { - if [ -e ${PID_FILE} ]; then + if [ -e ${PID_FILE} ] && [ "`su \"${SENSISION_USER}\" -c \"${JAVA_HOME}/bin/jps -lm|grep -wE $(cat ${PID_FILE})|cut -f 1 -d' '\"`" != "" ]; then su "${SENSISION_USER}" -c "${JAVA_HOME}/bin/jps -lm|grep -wE $(cat ${PID_FILE})" + else + echo "No instance of Sensision is currently running" + exit 1 fi } From 7bacee5a954966c17a48a0c405f1c54d2477ba45 Mon Sep 17 00:00:00 2001 From: David Morin Date: Fri, 22 Dec 2017 17:03:18 +0100 Subject: [PATCH 2/2] build: publish artefact on bintray automatically --- build.gradle | 2 ++ 1 file changed, 2 insertions(+) diff --git a/build.gradle b/build.gradle index 86153e6..f1d4e61 100644 --- a/build.gradle +++ b/build.gradle @@ -272,6 +272,7 @@ project(':sensision') { key = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_API_KEY') publications = [ 'sensisionService' ] + publish = true pkg { repo = 'generic' @@ -393,6 +394,7 @@ project(':sensision-lib') { key = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_API_KEY') publications = [ 'sensisionlib' ] + publish = true pkg { repo = 'maven'