Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 591502 Details for
Bug 831632
[RFE] Better kill patch for JON agent re-start scripts
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
better kill patch from case 00610945
better-kill.patch (text/plain), 3.04 KB, created by
Shaun Appleton
on 2012-06-13 13:30:28 UTC
(
hide
)
Description:
better kill patch from case 00610945
Filename:
MIME Type:
Creator:
Shaun Appleton
Created:
2012-06-13 13:30:28 UTC
Size:
3.04 KB
patch
obsolete
>51,52c51,59 >< _STATUS="RHQ Agent (no pidfile) is NOT running" >< _RUNNING=0 >--- >> _ZOMBIPID=`ps -ef|grep jon-agent|grep -v yum|grep -v grep|grep -v $$|grep -v $PPID|grep -v tail ` >> if [ -n "${_ZOMBIPID}" ]; then >> kill_jon_agent >> _STATUS="RHQ Agent was running but no pidfile found! Killed all jon-agent processes" >> _RUNNING=0 >> else >> _STATUS="RHQ Agent (no pidfile) is NOT running" >> _RUNNING=0 >> fi >63c70 >< if [ "x$1" != "x" ] && kill -0 $1 2>/dev/null ; then >--- >> if [ "x$1" != "x" ] && test -e "/proc/${1}" ; then >84a92,137 >> # Function that kill a jon-agent process - designed to be used if 'stop' failed >> # ---------------------------------------------------------------------- >> >> find_jon_agent_pid() >> { >> local process_name_pattern='java.*org.rhq.entreprise.agent.AgentMain' >> >> # retrieve PID from file and check if it is an active PID... >> if [ -e "${_PIDFILE}" ]; then >> pid=$( cat "${_PIDFILE}" | sed -e 's/ *//g' ) >> if [ ${pid} -gt 1 ]; then # hence there is a valid value >> if [ -e "/proc/${pid}" ] ; then >> echo "${pid}" >> return >> fi >> fi >> fi >> # ... otherwise, find out the proper pid >> nb_zombi_pids=$( pgrep -lf ${process_name_pattern} | wc -l ) >> if [ ${nb_zombi_pids} -gt 0 ]; then >> echo "${b_zombi_pids} pids reported." >> pgrep -lf ${process_name_pattern} | sed -e 's/^\([0-9]*\) .*$/\1/' >> fi >> } >> >> # ---------------------------------------------------------------------- >> # Function that kill a jon-agent process - designed to be used if 'stop' failed >> # ---------------------------------------------------------------------- >> >> kill_pids() { # "private" functions, to reduce code duplication - not to use directly >> local pids="${1}" >> local signal="${2}" >> >> if [ -n "${pids}" ]; then >> kill "${signal}" ${pids} >> fi >> } >> >> kill_jon_agent() { >> local pids=$( find_jon_agent_pid ) >> kill_pids "${pids}" "-TERM" >> sleep 2 >> pids=$( find_jon_agent_pid ) >> kill_pids ${pids} >> >> # ---------------------------------------------------------------------- >257,270c310 >< kill -TERM $_PID_TO_KILL >< >< sleep 5 >< check_status_of_pid $_PID_TO_KILL >< if [ "$_RUNNING" = "1" ]; then >< debug_wrapper_msg "Agent did not die yet, trying to kill it again" >< kill -TERM $_PID_TO_KILL >< fi >< >< while [ "$_RUNNING" = "1" ]; do >< sleep 2 >< check_status_of_pid $_PID_TO_KILL >< done >< >--- >> kill_jon_agent >286,297c326 >< >< _PID_TO_KILL=$_PID; >< >< # do not try to gracefully kill, use a hard -KILL/-9 >< echo "RHQ Agent (pid=${_PID_TO_KILL}) is being killed..." >< kill -9 $_PID_TO_KILL >< >< while [ "$_RUNNING" = "1" ]; do >< sleep 2 >< check_status_of_pid $_PID_TO_KILL >< done >< >--- >> kill_jon_agent
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 831632
: 591502