IDEMPIERE-3023 Update Dead Sessions when Server Shutdown

This commit is contained in:
Carlos Ruiz 2016-05-30 23:24:51 -05:00
parent d1c38adc54
commit d5e390c829
4 changed files with 88 additions and 60 deletions

View File

@ -618,23 +618,30 @@ stop () {
fi fi
echo -n "Stopping iDempiere ERP: " echo -n "Stopping iDempiere ERP: "
cd $IDEMPIERE_HOME/utils cd $IDEMPIERE_HOME/utils
log_warning_msg "Trying direct kill with signal -15" # try shutdown from OSGi console, then direct kill with signal 15, then signal 9
# try direct kill with signal 15, then signal 9 log_warning_msg "Trying shutdown from OSGi console"
kill -15 -`ps ax o pgid,command | grep -v grep | grep $IDEMPIERE_HOME | sed -e 's/^ *//g' | cut -f 1 -d " " | sort -u` ( echo exit; echo y; sleep 5 ) | telnet localhost 12612 > /dev/null 2>&1
sleep 5
getidempierestatus getidempierestatus
if [ $IDEMPIERESTATUS -ne 0 ] ; then if [ $IDEMPIERESTATUS -ne 0 ] ; then
log_success_msg "Service stopped with kill -15" log_success_msg "Service stopped with OSGi shutdown"
else else
echo "Trying direct kill with signal -9" log_warning_msg "Trying direct kill with signal -15"
kill -9 -`ps ax o pgid,command | grep -v grep | grep $IDEMPIERE_HOME | sed -e 's/^ *//g' | cut -f 1 -d " " | sort -u` kill -15 -`ps ax o pgid,command | grep -v grep | grep $IDEMPIERE_HOME | sed -e 's/^ *//g' | cut -f 1 -d " " | sort -u`
sleep 5 sleep 5
getidempierestatus getidempierestatus
if [ $IDEMPIERESTATUS -ne 0 ] ; then if [ $IDEMPIERESTATUS -ne 0 ] ; then
log_success_msg "Service stopped with kill -9" log_success_msg "Service stopped with kill -15"
else else
log_warning_msg "Service hasn't stopped" echo "Trying direct kill with signal -9"
fi kill -9 -`ps ax o pgid,command | grep -v grep | grep $IDEMPIERE_HOME | 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 -9"
else
log_warning_msg "Service hasn't stopped"
fi
fi
fi fi
return $RETVAL return $RETVAL
} }

View File

@ -87,24 +87,31 @@ stop () {
fi fi
echo -n "Stopping iDempiere ERP: " echo -n "Stopping iDempiere ERP: "
cd $IDEMPIERE_HOME/utils cd $IDEMPIERE_HOME/utils
. $ENVFILE . $ENVFILE
log_warning_msg "Trying direct kill with signal -15" # try shutdown from OSGi console, then direct kill with signal 15, then signal 9
# try direct kill with signal 15, then signal 9 log_warning_msg "Trying shutdown from OSGi console"
kill -15 -`ps ax o pgid,command | grep -v grep | grep $IDEMPIERE_HOME | sed -e 's/^ *//g' | cut -f 1 -d " " | sort -u` ( echo exit; echo y; sleep 5 ) | telnet localhost 12612 > /dev/null 2>&1
sleep 5
getidempierestatus getidempierestatus
if [ $IDEMPIERESTATUS -ne 0 ] ; then if [ $IDEMPIERESTATUS -ne 0 ] ; then
log_success_msg "Service stopped with kill -15" log_success_msg "Service stopped with OSGi shutdown"
else else
echo "Trying direct kill with signal -9" log_warning_msg "Trying direct kill with signal -15"
kill -9 -`ps ax o pgid,command | grep -v grep | grep $IDEMPIERE_HOME | sed -e 's/^ *//g' | cut -f 1 -d " " | sort -u` kill -15 -`ps ax o pgid,command | grep -v grep | grep $IDEMPIERE_HOME | sed -e 's/^ *//g' | cut -f 1 -d " " | sort -u`
sleep 5 sleep 5
getidempierestatus getidempierestatus
if [ $IDEMPIERESTATUS -ne 0 ] ; then if [ $IDEMPIERESTATUS -ne 0 ] ; then
log_success_msg "Service stopped with kill -9" log_success_msg "Service stopped with kill -15"
else else
log_warning_msg "Service hasn't stopped" echo "Trying direct kill with signal -9"
fi kill -9 -`ps ax o pgid,command | grep -v grep | grep $IDEMPIERE_HOME | 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 -9"
else
log_warning_msg "Service hasn't stopped"
fi
fi
fi fi
return $RETVAL return $RETVAL
} }

View File

@ -83,24 +83,31 @@ stop () {
fi fi
echo -n "Stopping iDempiere ERP: " echo -n "Stopping iDempiere ERP: "
cd $IDEMPIERE_HOME/utils cd $IDEMPIERE_HOME/utils
source $ENVFILE source $ENVFILE
echo "Trying direct kill with signal -15" # try shutdown from OSGi console, then direct kill with signal 15, then signal 9
# iDempiere didn't finish - try direct kill with signal 15, then signal 9 log_warning_msg "Trying shutdown from OSGi console"
kill -15 -`ps ax o pgid,command | grep -v grep | grep $IDEMPIERE_HOME | sed -e 's/^ *//g' | cut -f 1 -d " " | sort -u` ( echo exit; echo y; sleep 5 ) | telnet localhost 12612 > /dev/null 2>&1
sleep 5
getidempierestatus getidempierestatus
if [ $IDEMPIERESTATUS -ne 0 ] ; then if [ $IDEMPIERESTATUS -ne 0 ] ; then
echo_success echo_success
else else
echo "Trying direct kill with signal -9" log_warning_msg "Trying direct kill with signal -15"
kill -9 -`ps ax o pgid,command | grep -v grep | grep $IDEMPIERE_HOME | sed -e 's/^ *//g' | cut -f 1 -d " " | sort -u` kill -15 -`ps ax o pgid,command | grep -v grep | grep $IDEMPIERE_HOME | sed -e 's/^ *//g' | cut -f 1 -d " " | sort -u`
sleep 5 sleep 5
getidempierestatus getidempierestatus
if [ $IDEMPIERESTATUS -ne 0 ] ; then if [ $IDEMPIERESTATUS -ne 0 ] ; then
echo_success echo_success
else else
echo_warning echo "Trying direct kill with signal -9"
fi kill -9 -`ps ax o pgid,command | grep -v grep | grep $IDEMPIERE_HOME | sed -e 's/^ *//g' | cut -f 1 -d " " | sort -u`
sleep 5
getidempierestatus
if [ $IDEMPIERESTATUS -ne 0 ] ; then
echo_success
else
echo_warning
fi
fi
fi fi
RETVAL=$? RETVAL=$?
return $RETVAL return $RETVAL

View File

@ -114,25 +114,32 @@ stop () {
fi fi
echo -n "Stopping iDempiere ERP: " echo -n "Stopping iDempiere ERP: "
cd $IDEMPIERE_HOME/utils cd $IDEMPIERE_HOME/utils
. $ENVFILE . $ENVFILE
echo "Trying direct kill with signal -15" # try shutdown from OSGi console, then direct kill with signal 15, then signal 9
# try direct kill with signal 15, then signal 9 log_warning_msg "Trying shutdown from OSGi console"
kill -15 -`ps ax o pgid,command | grep -v grep | grep $IDEMPIERE_HOME | sed -e 's/^ *//g' | cut -f 1 -d " " | sort -u` ( echo exit; echo y; sleep 5 ) | telnet localhost 12612 > /dev/null 2>&1
sleep 5
getidempierestatus getidempierestatus
if [ $IDEMPIERESTATUS -ne 0 ] ; then if [ $IDEMPIERESTATUS -ne 0 ] ; then
echo "Service stopped with kill -15" echo "Service stopped with OSGi shutdown"
else else
echo "Trying direct kill with signal -9" echo "Trying direct kill with signal -15"
kill -9 -`ps ax o pgid,command | grep -v grep | grep $IDEMPIERE_HOME | sed -e 's/^ *//g' | cut -f 1 -d " " | sort -u` kill -15 -`ps ax o pgid,command | grep -v grep | grep $IDEMPIERE_HOME | sed -e 's/^ *//g' | cut -f 1 -d " " | sort -u`
sleep 5 sleep 5
getidempierestatus getidempierestatus
if [ $IDEMPIERESTATUS -ne 0 ] ; then if [ $IDEMPIERESTATUS -ne 0 ] ; then
echo "Service stopped with kill -9" echo "Service stopped with kill -15"
else else
echo "Service hasn't stopped" echo "Trying direct kill with signal -9"
rc_failed 1 kill -9 -`ps ax o pgid,command | grep -v grep | grep $IDEMPIERE_HOME | sed -e 's/^ *//g' | cut -f 1 -d " " | sort -u`
fi sleep 5
getidempierestatus
if [ $IDEMPIERESTATUS -ne 0 ] ; then
echo "Service stopped with kill -9"
else
echo "Service hasn't stopped"
rc_failed 1
fi
fi
fi fi
rc_status -v rc_status -v
} }