IDEMPIERE-3833:Detected idempiere service running

This commit is contained in:
hieplq 2018-11-29 15:11:48 +07:00
parent c24600a6d3
commit 785acb06be
5 changed files with 34 additions and 26 deletions

View File

@ -20,13 +20,16 @@ echo ===================================
echo Starting iDempiere Server
echo ===================================
# if don't set from service get default value
TELNET_PORT=${TELNET_PORT:-12612}
VMOPTS="-Dorg.osgi.framework.bootdelegation=sun.security.ssl,org.w3c.dom.events
-Dosgi.compatibility.bootdelegation=true
-Djetty.home=$BASE/jettyhome
-Djetty.base=$BASE/jettyhome
-Djetty.etc.config.urls=etc/jetty.xml,etc/jetty-deployer.xml,etc/jetty-ssl.xml,etc/jetty-ssl-context.xml,etc/jetty-http.xml,etc/jetty-alpn.xml,etc/jetty-http2.xml,etc/jetty-https.xml
-Dosgi.console=localhost:12612
-Dosgi.console=localhost:$TELNET_PORT
-Dmail.mime.encodefilename=true
-Dmail.mime.decodefilename=true
-Dmail.mime.encodeparameters=true

View File

@ -39,11 +39,13 @@ esac
# adjust these variables to your environment
IDEMPIERE_USER=idempiere
IDEMPIERE_HOME=/opt/idempiere-server
JAVA_HOME=`ls -r /usr/lib/jvm/java-[6789]-openjdk*/bin/javac /usr/lib/jvm/java-[89]-oracle*/bin/javac | head -1`
# in case you manual install java by use zip or your linux distros, or your java provider have difference pattern of path, please update here
JAVA_HOME=`ls -r /usr/lib/jvm/java-1[0-9]-openjdk*/bin/javac /usr/lib/jvm/java-1[0-9]-oracle*/bin/javac | head -1`
JAVA_HOME=`dirname $JAVA_HOME`
JAVA_HOME=`dirname $JAVA_HOME`
SU=su
export IDEMPIERE_HOME
export TELNET_PORT=12612
if [ $(id -u) != "0" ]
then
@ -533,8 +535,8 @@ Enter postgres password:"
}
getidempierestatus() {
IDEMPIERESTATUSSTRING=$(ps ax | grep java | grep org.adempiere.server.application | grep -v grep)
echo $IDEMPIERESTATUSSTRING | grep -q org.adempiere.server.application
IDEMPIERESTATUSSTRING=$(ps ax | grep java | grep ${IDEMPIERE_HOME} | grep -v grep)
echo $IDEMPIERESTATUSSTRING | grep -q ${IDEMPIERE_HOME}
IDEMPIERESTATUS=$?
}
@ -620,20 +622,20 @@ stop () {
cd $IDEMPIERE_HOME/utils
# try shutdown from OSGi console, then direct kill with signal 15, then signal 9
log_warning_msg "Trying shutdown from OSGi console"
( echo exit; echo y; sleep 5 ) | telnet localhost 12612 > /dev/null 2>&1
( echo exit; echo y; sleep 5 ) | telnet localhost ${TELNET_PORT} > /dev/null 2>&1
getidempierestatus
if [ $IDEMPIERESTATUS -ne 0 ] ; then
log_success_msg "Service stopped with OSGi shutdown"
else
log_warning_msg "Trying direct kill with signal -15"
kill -15 -`ps ax o pgid,command | grep org.adempiere.server.application | grep -v grep | sed -e 's/^ *//g' | cut -f 1 -d " " | sort -u`
kill -15 -`ps ax o pgid,command | grep ${IDEMPIERE_HOME} | grep -v grep | sed -e 's/^ *//g' | cut -f 1 -d " " | sort -u`
sleep 5
getidempierestatus
if [ $IDEMPIERESTATUS -ne 0 ] ; then
log_success_msg "Service stopped with kill -15"
else
log_warning_msg "Trying direct kill with signal -9"
kill -9 -`ps ax o pgid,command | grep org.adempiere.server.application | grep -v grep | sed -e 's/^ *//g' | cut -f 1 -d " " | sort -u`
kill -9 -`ps ax o pgid,command | grep ${IDEMPIERE_HOME} | grep -v grep | sed -e 's/^ *//g' | cut -f 1 -d " " | sort -u`
sleep 5
getidempierestatus
if [ $IDEMPIERESTATUS -ne 0 ] ; then
@ -664,7 +666,7 @@ dostatus () {
if [ $IDEMPIERESTATUS -eq 0 ] ; then
echo
echo "iDempiere is running:"
ps ax | grep org.adempiere.server.application | grep -v grep | sed 's/^[[:space:]]*\([[:digit:]]*\).*:[[:digit:]][[:digit:]][[:space:]]\(.*\)/\1 \2/'
ps ax | grep ${IDEMPIERE_HOME} | grep -v grep | sed 's/^[[:space:]]*\([[:digit:]]*\).*:[[:digit:]][[:digit:]][[:space:]]\(.*\)/\1 \2/'
echo
else
echo "iDempiere is stopped"

View File

@ -20,6 +20,7 @@
# adjust these variables to your environment
IDEMPIERE_HOME=/opt/idempiere-server
IDEMPIEREUSER=idempiere
export TELNET_PORT=12612
# Instead of using ENVFILE you can set JAVA_HOME, IDEMPIERE_HOME and add JAVA_HOME/bin to PATH
# in this case you can comment the source lines for ENVFILE below
# detected some problems with Hardy Heron ubuntu using the bash source command
@ -32,8 +33,8 @@ IDEMPIERESTATUS=
MAXITERATIONS=60
getidempierestatus() {
IDEMPIERESTATUSSTRING=$(ps ax | grep java | grep org.adempiere.server.application | grep -v grep)
echo $IDEMPIERESTATUSSTRING | grep -q org.adempiere.server.application
IDEMPIERESTATUSSTRING=$(ps ax | grep java | grep ${IDEMPIERE_HOME} | grep -v grep)
echo $IDEMPIERESTATUSSTRING | grep -q ${IDEMPIERE_HOME}
IDEMPIERESTATUS=$?
}
@ -90,20 +91,20 @@ stop () {
. $ENVFILE
# try shutdown from OSGi console, then direct kill with signal 15, then signal 9
log_warning_msg "Trying shutdown from OSGi console"
( echo exit; echo y; sleep 5 ) | telnet localhost 12612 > /dev/null 2>&1
( echo exit; echo y; sleep 5 ) | telnet localhost ${TELNET_PORT} > /dev/null 2>&1
getidempierestatus
if [ $IDEMPIERESTATUS -ne 0 ] ; then
log_success_msg "Service stopped with OSGi shutdown"
else
log_warning_msg "Trying direct kill with signal -15"
kill -15 -`ps ax o pgid,command | grep org.adempiere.server.application | grep -v grep | sed -e 's/^ *//g' | cut -f 1 -d " " | sort -u`
kill -15 -`ps ax o pgid,command | grep ${IDEMPIERE_HOME} | grep -v grep | sed -e 's/^ *//g' | cut -f 1 -d " " | sort -u`
sleep 5
getidempierestatus
if [ $IDEMPIERESTATUS -ne 0 ] ; then
log_success_msg "Service stopped with kill -15"
else
log_warning_msg "Trying direct kill with signal -9"
kill -9 -`ps ax o pgid,command | grep org.adempiere.server.application | grep -v grep | sed -e 's/^ *//g' | cut -f 1 -d " " | sort -u`
kill -9 -`ps ax o pgid,command | grep ${IDEMPIERE_HOME} | grep -v grep | sed -e 's/^ *//g' | cut -f 1 -d " " | sort -u`
sleep 5
getidempierestatus
if [ $IDEMPIERESTATUS -ne 0 ] ; then
@ -134,7 +135,7 @@ status () {
if [ $IDEMPIERESTATUS -eq 0 ] ; then
echo
echo "iDempiere is running:"
ps ax | grep org.adempiere.server.application | grep -v grep | sed 's/^[[:space:]]*\([[:digit:]]*\).*:[[:digit:]][[:digit:]][[:space:]]\(.*\)/\1 \2/'
ps ax | grep ${IDEMPIERE_HOME} | grep -v grep | sed 's/^[[:space:]]*\([[:digit:]]*\).*:[[:digit:]][[:digit:]][[:space:]]\(.*\)/\1 \2/'
echo
else
echo "iDempiere is stopped"

View File

@ -20,6 +20,7 @@
IDEMPIERE_HOME=/opt/idempiere-server
ENVFILE=$IDEMPIERE_HOME/utils/myEnvironment.sh
IDEMPIEREUSER=idempiere
export TELNET_PORT=12612
. /etc/rc.d/init.d/functions
@ -28,8 +29,8 @@ IDEMPIERESTATUS=
MAXITERATIONS=60 # 2 seconds every iteration, max wait 2 minutes
getidempierestatus() {
IDEMPIERESTATUSSTRING=$(ps ax | grep java | grep org.adempiere.server.application | grep -v grep)
echo $IDEMPIERESTATUSSTRING | grep -q org.adempiere.server.application
IDEMPIERESTATUSSTRING=$(ps ax | grep java | grep ${IDEMPIERE_HOME} | grep -v grep)
echo $IDEMPIERESTATUSSTRING | grep -q ${IDEMPIERE_HOME}
IDEMPIERESTATUS=$?
}
@ -86,20 +87,20 @@ stop () {
source $ENVFILE
# try shutdown from OSGi console, then direct kill with signal 15, then signal 9
echo "Trying shutdown from OSGi console"
( echo exit; echo y; sleep 5 ) | telnet localhost 12612 > /dev/null 2>&1
( echo exit; echo y; sleep 5 ) | telnet localhost ${TELNET_PORT} > /dev/null 2>&1
getidempierestatus
if [ $IDEMPIERESTATUS -ne 0 ] ; then
echo_success
else
echo "Trying direct kill with signal -15"
kill -15 -`ps ax o pgid,command | grep org.adempiere.server.application | grep -v grep | sed -e 's/^ *//g' | cut -f 1 -d " " | sort -u`
kill -15 -`ps ax o pgid,command | grep ${IDEMPIERE_HOME} | grep -v grep | sed -e 's/^ *//g' | cut -f 1 -d " " | sort -u`
sleep 5
getidempierestatus
if [ $IDEMPIERESTATUS -ne 0 ] ; then
echo_success
else
echo "Trying direct kill with signal -9"
kill -9 -`ps ax o pgid,command | grep org.adempiere.server.application | grep -v grep | sed -e 's/^ *//g' | cut -f 1 -d " " | sort -u`
kill -9 -`ps ax o pgid,command | grep ${IDEMPIERE_HOME} | grep -v grep | sed -e 's/^ *//g' | cut -f 1 -d " " | sort -u`
sleep 5
getidempierestatus
if [ $IDEMPIERESTATUS -ne 0 ] ; then
@ -131,7 +132,7 @@ status () {
if [ $IDEMPIERESTATUS -eq 0 ] ; then
echo
echo "iDempiere is running:"
ps ax | grep org.adempiere.server.application | grep -v grep | sed 's/^[[:space:]]*\([[:digit:]]*\).*:[[:digit:]][[:digit:]][[:space:]]\(.*\)/\1 \2/'
ps ax | grep ${IDEMPIERE_HOME} | grep -v grep | sed 's/^[[:space:]]*\([[:digit:]]*\).*:[[:digit:]][[:digit:]][[:space:]]\(.*\)/\1 \2/'
echo
else
echo "iDempiere is stopped"

View File

@ -19,6 +19,7 @@
# adjust these variables to your environment
IDEMPIERE_HOME=/opt/idempiere-server
IDEMPIEREUSER=idempiere
export TELNET_PORT=12612
# Instead of using ENVFILE you can set JAVA_HOME, IDEMPIERE_HOME and add JAVA_HOME/bin to PATH
# in this case you can comment the source lines for ENVFILE below
# detected some problems with Hardy Heron ubuntu using the bash source command
@ -57,8 +58,8 @@ IDEMPIERESTATUS=
MAXITERATIONS=60
getidempierestatus() {
IDEMPIERESTATUSSTRING=$(ps ax | grep java | grep org.adempiere.server.application | grep -v grep)
echo $IDEMPIERESTATUSSTRING | grep -q org.adempiere.server.application
IDEMPIERESTATUSSTRING=$(ps ax | grep java | grep ${IDEMPIERE_HOME} | grep -v grep)
echo $IDEMPIERESTATUSSTRING | grep -q ${IDEMPIERE_HOME}
IDEMPIERESTATUS=$?
}
@ -117,20 +118,20 @@ stop () {
. $ENVFILE
# try shutdown from OSGi console, then direct kill with signal 15, then signal 9
log_warning_msg "Trying shutdown from OSGi console"
( echo exit; echo y; sleep 5 ) | telnet localhost 12612 > /dev/null 2>&1
( echo exit; echo y; sleep 5 ) | telnet localhost ${TELNET_PORT} > /dev/null 2>&1
getidempierestatus
if [ $IDEMPIERESTATUS -ne 0 ] ; then
echo "Service stopped with OSGi shutdown"
else
echo "Trying direct kill with signal -15"
kill -15 -`ps ax o pgid,command | grep org.adempiere.server.application | grep -v grep | sed -e 's/^ *//g' | cut -f 1 -d " " | sort -u`
kill -15 -`ps ax o pgid,command | grep ${IDEMPIERE_HOME} | grep -v grep | sed -e 's/^ *//g' | cut -f 1 -d " " | sort -u`
sleep 5
getidempierestatus
if [ $IDEMPIERESTATUS -ne 0 ] ; then
echo "Service stopped with kill -15"
else
echo "Trying direct kill with signal -9"
kill -9 -`ps ax o pgid,command | grep org.adempiere.server.application | grep -v grep | sed -e 's/^ *//g' | cut -f 1 -d " " | sort -u`
kill -9 -`ps ax o pgid,command | grep ${IDEMPIERE_HOME} | grep -v grep | sed -e 's/^ *//g' | cut -f 1 -d " " | sort -u`
sleep 5
getidempierestatus
if [ $IDEMPIERESTATUS -ne 0 ] ; then
@ -166,7 +167,7 @@ status () {
if [ $IDEMPIERESTATUS -eq 0 ] ; then
echo
echo "iDempiere is running:"
ps ax | grep org.adempiere.server.application | grep -v grep | sed 's/^[[:space:]]*\([[:digit:]]*\).*:[[:digit:]][[:digit:]][[:space:]]\(.*\)/\1 \2/'
ps ax | grep ${IDEMPIERE_HOME} | grep -v grep | sed 's/^[[:space:]]*\([[:digit:]]*\).*:[[:digit:]][[:digit:]][[:space:]]\(.*\)/\1 \2/'
echo
else
echo "iDempiere is stopped"