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
echo -n "Stopping iDempiere ERP: "
cd $IDEMPIERE_HOME/utils
log_warning_msg "Trying direct kill with signal -15"
# try direct kill with signal 15, then signal 9
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
# 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
getidempierestatus
if [ $IDEMPIERESTATUS -ne 0 ] ; then
log_success_msg "Service stopped with kill -15"
log_success_msg "Service stopped with OSGi shutdown"
else
echo "Trying direct kill with signal -9"
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
log_warning_msg "Trying direct kill with signal -15"
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
getidempierestatus
if [ $IDEMPIERESTATUS -ne 0 ] ; then
log_success_msg "Service stopped with kill -15"
else
echo "Trying direct kill with signal -9"
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
return $RETVAL
}

View File

@ -87,24 +87,31 @@ stop () {
fi
echo -n "Stopping iDempiere ERP: "
cd $IDEMPIERE_HOME/utils
. $ENVFILE
log_warning_msg "Trying direct kill with signal -15"
# try direct kill with signal 15, then signal 9
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
. $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
getidempierestatus
if [ $IDEMPIERESTATUS -ne 0 ] ; then
log_success_msg "Service stopped with kill -15"
log_success_msg "Service stopped with OSGi shutdown"
else
echo "Trying direct kill with signal -9"
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
log_warning_msg "Trying direct kill with signal -15"
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
getidempierestatus
if [ $IDEMPIERESTATUS -ne 0 ] ; then
log_success_msg "Service stopped with kill -15"
else
echo "Trying direct kill with signal -9"
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
return $RETVAL
}

View File

@ -83,24 +83,31 @@ stop () {
fi
echo -n "Stopping iDempiere ERP: "
cd $IDEMPIERE_HOME/utils
source $ENVFILE
echo "Trying direct kill with signal -15"
# iDempiere didn't finish - try direct kill with signal 15, then signal 9
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
source $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
getidempierestatus
if [ $IDEMPIERESTATUS -ne 0 ] ; then
echo_success
echo_success
else
echo "Trying direct kill with signal -9"
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
log_warning_msg "Trying direct kill with signal -15"
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
getidempierestatus
if [ $IDEMPIERESTATUS -ne 0 ] ; then
echo_success
else
echo "Trying direct kill with signal -9"
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
RETVAL=$?
return $RETVAL

View File

@ -114,25 +114,32 @@ stop () {
fi
echo -n "Stopping iDempiere ERP: "
cd $IDEMPIERE_HOME/utils
. $ENVFILE
echo "Trying direct kill with signal -15"
# try direct kill with signal 15, then signal 9
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
. $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
getidempierestatus
if [ $IDEMPIERESTATUS -ne 0 ] ; then
echo "Service stopped with kill -15"
echo "Service stopped with OSGi shutdown"
else
echo "Trying direct kill with signal -9"
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 "Service stopped with kill -9"
else
echo "Service hasn't stopped"
rc_failed 1
fi
echo "Trying direct kill with signal -15"
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
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 -v grep | grep $IDEMPIERE_HOME | sed -e 's/^ *//g' | cut -f 1 -d " " | sort -u`
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
rc_status -v
}