<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: script that kills ghost processes in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/script-that-kills-ghost-processes/m-p/3509796#M705380</link>
    <description>We have a similar issue with our Software AG users.&lt;BR /&gt;&lt;BR /&gt;The close the app instead of logging out and the process remains for 30 minutes until timeout.&lt;BR /&gt;&lt;BR /&gt;You are moving in the right direction, but take care to distinguish live oracle sessions from orphan ones.&lt;BR /&gt;&lt;BR /&gt;User training can help with this too.&lt;BR /&gt;&lt;BR /&gt;SEP</description>
    <pubDate>Tue, 22 Mar 2005 14:05:02 GMT</pubDate>
    <dc:creator>Steven E. Protter</dc:creator>
    <dc:date>2005-03-22T14:05:02Z</dc:date>
    <item>
      <title>script that kills ghost processes</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-that-kills-ghost-processes/m-p/3509795#M705379</link>
      <description>hi all&lt;BR /&gt;&lt;BR /&gt;we have a system thats been running acucobol and oracle for about 7 yrs.  sometimes when the users get ancy they shutdown their pcs and leave ghosts running taking cpu time.  we have this script that runs and kills them, but i noticed that the first part(processlist, userlist) doesnt work, the second part does.  &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;any ideas?&lt;BR /&gt;&lt;BR /&gt;thx in advance&lt;BR /&gt;&lt;BR /&gt;# The purpose of this script is to clean up orphan processes.&lt;BR /&gt;# Exclusions are implemented by the "grep -v" command.&lt;BR /&gt;#&lt;BR /&gt;set -o xtrace&lt;BR /&gt;date&lt;BR /&gt;cd /util&lt;BR /&gt;&lt;BR /&gt;# This loop generates a list of users, then generates a list of processes&lt;BR /&gt;# associated with each users id. If the terminal is a "?" it kills them.&lt;BR /&gt;&lt;BR /&gt;#USERLIST&lt;BR /&gt;for user in `/usr/bin/ps -ft? | /usr/bin/grep "\-sh" | \&lt;BR /&gt;             /usr/bin/grep -v root |/usr/bin/grep -v oracle|/usr/bin/grep -v ora&lt;BR /&gt;_|/usr/bin/grep -v ftpmat |/usr/bin/grep -v ftplaw|/usr/bin/grep -v lawcron|/usr&lt;BR /&gt;/bin/grep -v snamat|awk '{print $1}`&lt;BR /&gt;do&lt;BR /&gt;#PROCESSLIST&lt;BR /&gt;        /usr/bin/ps -fu $user | /usr/bin/grep -v PID | \&lt;BR /&gt;        /usr/bin/awk '{if ($6 == "?") {print $2}}' | \&lt;BR /&gt;        /usr/bin/xargs -n1 kill 2&amp;gt;&amp;gt;/dev/null&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;# This loop picks up child processes that have that have lost their parent&lt;BR /&gt;# user processes.  It is repeated for throughness.&lt;BR /&gt;&lt;BR /&gt;for proc in `ps -ft "?" | grep -v ftpmat |grep -v root|grep -v oracle|grep -v or&lt;BR /&gt;a_| grep -v snamat | grep -v lawcron | grep -v fptlaw | grep -e runwcis -e runcm&lt;BR /&gt;s -e runplis -e runctms | awk '{print $2}'`&lt;BR /&gt;do&lt;BR /&gt;    ps -ef | grep " "$proc" " | grep -v grep | awk '{print $2}' | \&lt;BR /&gt;    sort -r | xargs -n 1 kill&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;sleep 5&lt;BR /&gt;&lt;BR /&gt;for proc in `ps -ft "?" | grep -v ftpmat |grep -v root|grep -v oracle|grep -v or&lt;BR /&gt;a_| grep -v snamat | grep -v lawcron | grep -v ftplaw | grep -e runwcis -e runcm&lt;BR /&gt;s -e runplis -e runctms | awk '{print $2}'`&lt;BR /&gt;do&lt;BR /&gt;    ps -ef | grep " "$proc" " | grep -v grep | awk '{print $2}' | \&lt;BR /&gt;    sort -r | xargs -n 1 kill&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 22 Mar 2005 13:59:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-that-kills-ghost-processes/m-p/3509795#M705379</guid>
      <dc:creator>p7</dc:creator>
      <dc:date>2005-03-22T13:59:45Z</dc:date>
    </item>
    <item>
      <title>Re: script that kills ghost processes</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-that-kills-ghost-processes/m-p/3509796#M705380</link>
      <description>We have a similar issue with our Software AG users.&lt;BR /&gt;&lt;BR /&gt;The close the app instead of logging out and the process remains for 30 minutes until timeout.&lt;BR /&gt;&lt;BR /&gt;You are moving in the right direction, but take care to distinguish live oracle sessions from orphan ones.&lt;BR /&gt;&lt;BR /&gt;User training can help with this too.&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Tue, 22 Mar 2005 14:05:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-that-kills-ghost-processes/m-p/3509796#M705380</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2005-03-22T14:05:02Z</dc:date>
    </item>
    <item>
      <title>Re: script that kills ghost processes</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-that-kills-ghost-processes/m-p/3509797#M705381</link>
      <description>&lt;BR /&gt;Aren't ghosts already dead? It's like Night of the Living Dead - You kill them and they just keep coming back.&lt;BR /&gt;&lt;BR /&gt;My idea, and it worked in a lot of banks: remove the users keyboard and make them sign it back out from the VP. See how long it takes them to remember to gracefully shutdown their applications!!!&lt;BR /&gt;&lt;BR /&gt;live free or die&lt;BR /&gt;harry d brown jr</description>
      <pubDate>Tue, 22 Mar 2005 14:21:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-that-kills-ghost-processes/m-p/3509797#M705381</guid>
      <dc:creator>harry d brown jr</dc:creator>
      <dc:date>2005-03-22T14:21:23Z</dc:date>
    </item>
    <item>
      <title>Re: script that kills ghost processes</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-that-kills-ghost-processes/m-p/3509798#M705382</link>
      <description>yea i know, but they wont listen!&lt;BR /&gt;&lt;BR /&gt;any other ideas, thx&lt;BR /&gt;</description>
      <pubDate>Tue, 22 Mar 2005 15:03:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-that-kills-ghost-processes/m-p/3509798#M705382</guid>
      <dc:creator>p7</dc:creator>
      <dc:date>2005-03-22T15:03:34Z</dc:date>
    </item>
    <item>
      <title>Re: script that kills ghost processes</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-that-kills-ghost-processes/m-p/3509799#M705383</link>
      <description>If I understand what you want : all processes owned by a user who has a -sh running with no terminal. Then this one seems to work :&lt;BR /&gt;&lt;BR /&gt;----- starts code&lt;BR /&gt;for user in `/usr/bin/ps -ft? | \&lt;BR /&gt;  /usr/bin/grep "\-sh" | \&lt;BR /&gt;  /usr/bin/grep -v root | \&lt;BR /&gt;  /usr/bin/grep -v oracle | \&lt;BR /&gt;  /usr/bin/grep -v ora_ | \&lt;BR /&gt;  /usr/bin/grep -v ftpmat | \&lt;BR /&gt;  /usr/bin/grep -v ftplaw | \&lt;BR /&gt;  /usr/bin/grep -v lawcron | \&lt;BR /&gt;  /usr/bin/grep -v snamat | \&lt;BR /&gt;  awk '{print $1}'`&lt;BR /&gt;do&lt;BR /&gt;  /usr/bin/ps -ft? -u $user | /usr/bin/grep -v PID | /usr/bin/awk '{print $2}' | /usr/bin/xargs kill&lt;BR /&gt;done&lt;BR /&gt;----- ends code&lt;BR /&gt;&lt;BR /&gt;Some few points to discuss :&lt;BR /&gt;. If a user have two sessions and one has no terminal, your procedure will kill his two sessions&lt;BR /&gt;. there's a missing ' before the last ` but it doesn't seem to be a problem :)&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;Fred&lt;BR /&gt;</description>
      <pubDate>Wed, 23 Mar 2005 04:16:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-that-kills-ghost-processes/m-p/3509799#M705383</guid>
      <dc:creator>Fred Ruffet</dc:creator>
      <dc:date>2005-03-23T04:16:08Z</dc:date>
    </item>
  </channel>
</rss>

