- Fix scripts to new java 6 conditions
- improve to execute kill when it detects that server didn't stop
This commit is contained in:
parent
4c58c7e1c1
commit
0eaee94caa
|
@ -25,7 +25,7 @@ ADEMPIEREUSER=adempiere
|
|||
# detected some problems with Hardy Heron ubuntu using the bash source command
|
||||
ENVFILE=/home/adempiere/.bashrc
|
||||
# STOPMESSAGE="Halting VM" # Message when using java 5
|
||||
STOPMESSAGE="INFO.*\[Server\].*Shutting down the server" # Message when using java 6
|
||||
STOPMESSAGE="INFO.*Server\].*Shutdown complete" # Message when using java 6
|
||||
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
|
@ -57,7 +57,7 @@ start () {
|
|||
ITERATIONS=0
|
||||
while [ $STATUSTEST -eq 0 ] ; do
|
||||
sleep 2
|
||||
tail -n 5 $LOGFILE | grep -q 'INFO.*\[Server\].*Started in' && STATUSTEST=1
|
||||
tail -n 9 $LOGFILE | grep -q 'INFO.*\[Server\].*Started in' && STATUSTEST=1
|
||||
echo -n "."
|
||||
ITERATIONS=`expr $ITERATIONS + 1`
|
||||
if [ $ITERATIONS -gt $MAXITERATIONS ]
|
||||
|
@ -87,7 +87,8 @@ stop () {
|
|||
fi
|
||||
echo -n "Stopping ADempiere ERP: "
|
||||
. $ENVFILE
|
||||
export LASTLOG=`ls -t $ADEMPIERE_HOME/jboss/server/adempiere/log/adempiere_??????????????.log | head -1`
|
||||
# export LASTLOG=`ls -t $ADEMPIERE_HOME/jboss/server/adempiere/log/adempiere_??????????????.log | head -1`
|
||||
export LASTLOG=$ADEMPIERE_HOME/jboss/server/adempiere/log/server.log
|
||||
su $ADEMPIEREUSER -c "cd $EXECDIR/utils;$EXECDIR/utils/RUN_Server2Stop.sh &> /dev/null &"
|
||||
RETVAL=$?
|
||||
if [ $RETVAL -eq 0 ] ; then
|
||||
|
@ -107,6 +108,24 @@ stop () {
|
|||
if [ $STATUSTEST -eq 0 ]
|
||||
then
|
||||
log_warning_msg "Service hasn't stopped within the timeout allowed, please review file $LASTLOG to see the status of the service"
|
||||
log_warning_msg "Trying direct kill with signal -15"
|
||||
# Adempiere didn't finish - try direct kill with signal 15, then signal 9
|
||||
kill -15 `ps ax | grep -v grep | grep $EXECDIR | sed -e 's/^ *//g' | cut -f 1 -d " "`
|
||||
sleep 5
|
||||
getadempierestatus
|
||||
if [ $ADEMPIERESTATUS -ne 0 ] ; then
|
||||
log_success_msg "Service stopped with kill -15"
|
||||
else
|
||||
echo "Trying direct kill with signal -9"
|
||||
kill -9 `ps ax | grep -v grep | grep $EXECDIR | sed -e 's/^ *//g' | cut -f 1 -d " "`
|
||||
sleep 5
|
||||
getadempierestatus
|
||||
if [ $ADEMPIERESTATUS -ne 0 ] ; then
|
||||
log_success_msg "Service stopped with kill -9"
|
||||
else
|
||||
log_warning_msg "Service hasn't stopped"
|
||||
fi
|
||||
fi
|
||||
else
|
||||
log_success_msg "Service stopped"
|
||||
fi
|
||||
|
@ -147,27 +166,21 @@ case "$1" in
|
|||
start)
|
||||
start
|
||||
;;
|
||||
|
||||
stop)
|
||||
stop
|
||||
;;
|
||||
|
||||
reload)
|
||||
restart
|
||||
;;
|
||||
|
||||
restart)
|
||||
restart
|
||||
;;
|
||||
|
||||
condrestart)
|
||||
condrestart
|
||||
;;
|
||||
|
||||
status)
|
||||
rhstatus
|
||||
;;
|
||||
|
||||
*)
|
||||
echo $"Usage: $0 {start|stop|reload|restart|condrestart|status}"
|
||||
exit 1
|
||||
|
|
|
@ -21,7 +21,7 @@ EXECDIR=/home/adempiere/Adempiere
|
|||
ENVFILE=/home/adempiere/.bash_profile
|
||||
ADEMPIEREUSER=adempiere
|
||||
# STOPMESSAGE="Halting VM" # Message when using java 5
|
||||
STOPMESSAGE="INFO.*\[Server\].*Shutting down the server" # Message when using java 6
|
||||
STOPMESSAGE="INFO.*Server\].*Shutdown complete" # Message when using java 6
|
||||
|
||||
. /etc/rc.d/init.d/functions
|
||||
|
||||
|
@ -53,7 +53,7 @@ start () {
|
|||
ITERATIONS=0
|
||||
while [ $STATUSTEST -eq 0 ] ; do
|
||||
sleep 2
|
||||
tail -n 5 $LOGFILE | grep -q 'INFO.*\[Server\].*Started in' && STATUSTEST=1
|
||||
tail -n 9 $LOGFILE | grep -q 'INFO.*\[Server\].*Started in' && STATUSTEST=1
|
||||
echo -n "."
|
||||
ITERATIONS=`expr $ITERATIONS + 1`
|
||||
if [ $ITERATIONS -gt $MAXITERATIONS ]
|
||||
|
@ -84,7 +84,8 @@ stop () {
|
|||
fi
|
||||
echo -n "Stopping ADempiere ERP: "
|
||||
source $ENVFILE
|
||||
export LASTLOG=`ls -t $ADEMPIERE_HOME/jboss/server/adempiere/log/adempiere_??????????????.log | head -1`
|
||||
# export LASTLOG=`ls -t $ADEMPIERE_HOME/jboss/server/adempiere/log/adempiere_??????????????.log | head -1`
|
||||
export LASTLOG=$ADEMPIERE_HOME/jboss/server/adempiere/log/server.log
|
||||
su $ADEMPIEREUSER -c "cd $EXECDIR/utils;$EXECDIR/utils/RUN_Server2Stop.sh &> /dev/null &"
|
||||
RETVAL=$?
|
||||
if [ $RETVAL -eq 0 ] ; then
|
||||
|
@ -104,7 +105,24 @@ stop () {
|
|||
if [ $STATUSTEST -eq 0 ]
|
||||
then
|
||||
echo "Service hasn't stopped within the timeout allowed, please review file $LASTLOG to see the status of the service"
|
||||
echo "Trying direct kill with signal -15"
|
||||
# Adempiere didn't finish - try direct kill with signal 15, then signal 9
|
||||
kill -15 `ps ax | grep -v grep | grep $EXECDIR | sed -e 's/^ *//g' | cut -f 1 -d " "`
|
||||
sleep 5
|
||||
getadempierestatus
|
||||
if [ $ADEMPIERESTATUS -ne 0 ] ; then
|
||||
echo_success
|
||||
else
|
||||
echo "Trying direct kill with signal -9"
|
||||
kill -9 `ps ax | grep -v grep | grep $EXECDIR | sed -e 's/^ *//g' | cut -f 1 -d " "`
|
||||
sleep 5
|
||||
getadempierestatus
|
||||
if [ $ADEMPIERESTATUS -ne 0 ] ; then
|
||||
echo_success
|
||||
else
|
||||
echo_warning
|
||||
fi
|
||||
fi
|
||||
else
|
||||
echo_success
|
||||
fi
|
||||
|
@ -118,7 +136,7 @@ stop () {
|
|||
|
||||
restart () {
|
||||
stop
|
||||
sleep 1
|
||||
sleep 2
|
||||
start
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue