Implement [2845209] - Linux adempiere start script

https://sourceforge.net/tracker/index.php?func=detail&aid=2845209&group_id=176962&atid=879332
Thanks to Paul Aviles
This commit is contained in:
Carlos Ruiz 2009-09-13 21:49:10 +00:00
parent 7d8cfb1ecc
commit 7147bcda2d
2 changed files with 8 additions and 4 deletions

View File

@ -22,6 +22,8 @@ ADEMPIEREUSER=adempiere
# in this case you can comment the source lines for ENVFILE below # in this case you can comment the source lines for ENVFILE below
# detected some problems with Hardy Heron ubuntu using the bash source command # detected some problems with Hardy Heron ubuntu using the bash source command
ENVFILE=/home/adempiere/.bashrc ENVFILE=/home/adempiere/.bashrc
# STOPMESSAGE="Halting VM" # Message when using java 5
STOPMESSAGE="INFO.*\[Server\].*Shutting down the server" # Message when using java 6
. /lib/lsb/init-functions . /lib/lsb/init-functions
@ -92,7 +94,7 @@ stop () {
ITERATIONS=0 ITERATIONS=0
while [ $STATUSTEST -eq 0 ] ; do while [ $STATUSTEST -eq 0 ] ; do
sleep 2 sleep 2
tail -n 5 $LASTLOG | grep -q 'Halting VM' && STATUSTEST=1 tail -n 9 $LASTLOG | grep -q "$STOPMESSAGE" && STATUSTEST=1
echo -n "." echo -n "."
ITERATIONS=`expr $ITERATIONS + 1` ITERATIONS=`expr $ITERATIONS + 1`
if [ $ITERATIONS -gt $MAXITERATIONS ] if [ $ITERATIONS -gt $MAXITERATIONS ]

View File

@ -20,6 +20,8 @@
EXECDIR=/home/adempiere/Adempiere EXECDIR=/home/adempiere/Adempiere
ENVFILE=/home/adempiere/.bash_profile ENVFILE=/home/adempiere/.bash_profile
ADEMPIEREUSER=adempiere ADEMPIEREUSER=adempiere
# STOPMESSAGE="Halting VM" # Message when using java 5
STOPMESSAGE="INFO.*\[Server\].*Shutting down the server" # Message when using java 6
. /etc/rc.d/init.d/functions . /etc/rc.d/init.d/functions
@ -29,7 +31,7 @@ MAXITERATIONS=60 # 2 seconds every iteration, max wait 2 minutes)
getadempierestatus() { getadempierestatus() {
ADEMPIERESTATUSSTRING=$(ps ax | grep -v grep | grep $EXECDIR) ADEMPIERESTATUSSTRING=$(ps ax | grep -v grep | grep $EXECDIR)
echo $ADEMPIERESTATUSSTRING | grep $EXECDIR &> /dev/null echo $ADEMPIERESTATUSSTRING | grep -q $EXECDIR
ADEMPIERESTATUS=$? ADEMPIERESTATUS=$?
} }
@ -51,7 +53,7 @@ start () {
ITERATIONS=0 ITERATIONS=0
while [ $STATUSTEST -eq 0 ] ; do while [ $STATUSTEST -eq 0 ] ; do
sleep 2 sleep 2
tail -n 5 $LOGFILE | grep 'INFO.*\[Server\].*Started in' &> /dev/null && STATUSTEST=1 tail -n 5 $LOGFILE | grep -q 'INFO.*\[Server\].*Started in' && STATUSTEST=1
echo -n "." echo -n "."
ITERATIONS=`expr $ITERATIONS + 1` ITERATIONS=`expr $ITERATIONS + 1`
if [ $ITERATIONS -gt $MAXITERATIONS ] if [ $ITERATIONS -gt $MAXITERATIONS ]
@ -91,7 +93,7 @@ stop () {
ITERATIONS=0 ITERATIONS=0
while [ $STATUSTEST -eq 0 ] ; do while [ $STATUSTEST -eq 0 ] ; do
sleep 2 sleep 2
tail -n 5 $LASTLOG | grep 'Halting VM' &> /dev/null && STATUSTEST=1 tail -n 9 $LASTLOG | grep -q "$STOPMESSAGE" && STATUSTEST=1
echo -n "." echo -n "."
ITERATIONS=`expr $ITERATIONS + 1` ITERATIONS=`expr $ITERATIONS + 1`
if [ $ITERATIONS -gt $MAXITERATIONS ] if [ $ITERATIONS -gt $MAXITERATIONS ]