<?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: kill shell script in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/kill-shell-script/m-p/3117198#M150003</link>
    <description>Hi Brent,&lt;BR /&gt;&lt;BR /&gt;you need field #2 in the ps output.&lt;BR /&gt;&lt;BR /&gt;ps -ef | grep jobname | grep -v grep | awk '{print $2}'&lt;BR /&gt;&lt;BR /&gt;field #3 is the parent process.&lt;BR /&gt;&lt;BR /&gt;Michael&lt;BR /&gt;</description>
    <pubDate>Wed, 12 Nov 2003 11:24:38 GMT</pubDate>
    <dc:creator>Michael Schulte zur Sur</dc:creator>
    <dc:date>2003-11-12T11:24:38Z</dc:date>
    <item>
      <title>kill shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/kill-shell-script/m-p/3117193#M149998</link>
      <description>I need to determine the PID for a process in a shell script, then kill the process.&lt;BR /&gt;&lt;BR /&gt;Example:&lt;BR /&gt;&lt;BR /&gt;[sdatpp01][/home/root] #ps -ef | grep dsmc   &lt;BR /&gt;    root 12117     1 13  Nov  6  ?        40:01 dsmc sched&lt;BR /&gt;    root 27781 23503  2 10:13:11 pts/0     0:00 grep dsmc&lt;BR /&gt;[sdatpp01][/home/root]&lt;BR /&gt;&lt;BR /&gt;In this case I need to put the PID 12117 in a variable PID$&lt;BR /&gt;&lt;BR /&gt;how do I do this in a script ?</description>
      <pubDate>Wed, 12 Nov 2003 11:12:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/kill-shell-script/m-p/3117193#M149998</guid>
      <dc:creator>Brent W. Moll</dc:creator>
      <dc:date>2003-11-12T11:12:07Z</dc:date>
    </item>
    <item>
      <title>Re: kill shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/kill-shell-script/m-p/3117194#M149999</link>
      <description>Here is a script. It might work off the shelf, or require minor modification.&lt;BR /&gt;&lt;BR /&gt;Attached.&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Wed, 12 Nov 2003 11:13:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/kill-shell-script/m-p/3117194#M149999</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2003-11-12T11:13:21Z</dc:date>
    </item>
    <item>
      <title>Re: kill shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/kill-shell-script/m-p/3117195#M150000</link>
      <description>In sh and ksh, $PID is the script process, $PPID is the process that ran the script.&lt;BR /&gt;&lt;BR /&gt;If you are looking to extract a PID from a ps listing, try this:&lt;BR /&gt;&lt;BR /&gt;_PID=`ps -ef|grep $_STRING|tr -s " "|cut -d" " -f3`&lt;BR /&gt;&lt;BR /&gt;mark</description>
      <pubDate>Wed, 12 Nov 2003 11:15:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/kill-shell-script/m-p/3117195#M150000</guid>
      <dc:creator>Mark Greene_1</dc:creator>
      <dc:date>2003-11-12T11:15:48Z</dc:date>
    </item>
    <item>
      <title>Re: kill shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/kill-shell-script/m-p/3117196#M150001</link>
      <description>Brent,&lt;BR /&gt;&lt;BR /&gt;Here's a sample of one of our kill scripts:&lt;BR /&gt;&lt;BR /&gt;for PID in `ps -ef |grep web_command | grep -v grep |awk '{ print $2 }'`&lt;BR /&gt;        do&lt;BR /&gt;                kill -9 $PID&lt;BR /&gt;                echo "web_command.ksh stopped"&lt;BR /&gt;        done&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Note that the usage of kill -9 is not recommended because it does not allow for the normal housekeeping when a process terminates and may leave memory allocated, etc, etc.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Pete</description>
      <pubDate>Wed, 12 Nov 2003 11:17:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/kill-shell-script/m-p/3117196#M150001</guid>
      <dc:creator>Pete Randall</dc:creator>
      <dc:date>2003-11-12T11:17:25Z</dc:date>
    </item>
    <item>
      <title>Re: kill shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/kill-shell-script/m-p/3117197#M150002</link>
      <description>Pete you are so brutal.&lt;BR /&gt;&lt;BR /&gt;Round here we like to give things chance to die first.&lt;BR /&gt;&lt;BR /&gt;Instead of &lt;BR /&gt;  kill -9 ${PID}&lt;BR /&gt;&lt;BR /&gt;we would have&lt;BR /&gt;  for sig in 1 2 3 15 9&lt;BR /&gt;  do&lt;BR /&gt;    kill -${sig} {PID} 2&amp;gt;/dev/null&lt;BR /&gt;  done&lt;BR /&gt;&lt;BR /&gt;-- Graham</description>
      <pubDate>Wed, 12 Nov 2003 11:24:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/kill-shell-script/m-p/3117197#M150002</guid>
      <dc:creator>Graham Cameron_1</dc:creator>
      <dc:date>2003-11-12T11:24:17Z</dc:date>
    </item>
    <item>
      <title>Re: kill shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/kill-shell-script/m-p/3117198#M150003</link>
      <description>Hi Brent,&lt;BR /&gt;&lt;BR /&gt;you need field #2 in the ps output.&lt;BR /&gt;&lt;BR /&gt;ps -ef | grep jobname | grep -v grep | awk '{print $2}'&lt;BR /&gt;&lt;BR /&gt;field #3 is the parent process.&lt;BR /&gt;&lt;BR /&gt;Michael&lt;BR /&gt;</description>
      <pubDate>Wed, 12 Nov 2003 11:24:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/kill-shell-script/m-p/3117198#M150003</guid>
      <dc:creator>Michael Schulte zur Sur</dc:creator>
      <dc:date>2003-11-12T11:24:38Z</dc:date>
    </item>
    <item>
      <title>Re: kill shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/kill-shell-script/m-p/3117199#M150004</link>
      <description>Graham,&lt;BR /&gt;&lt;BR /&gt;True, it's brutal but it's a shutdown script for an unimportant process (and I did note that it's not recommended).  Since we're shutting down anyway, why would I care?  In other circumstances you method would be much more appropriate.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Pete</description>
      <pubDate>Wed, 12 Nov 2003 11:29:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/kill-shell-script/m-p/3117199#M150004</guid>
      <dc:creator>Pete Randall</dc:creator>
      <dc:date>2003-11-12T11:29:17Z</dc:date>
    </item>
    <item>
      <title>Re: kill shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/kill-shell-script/m-p/3117200#M150005</link>
      <description>Hi Pete,&lt;BR /&gt;&lt;BR /&gt;What do you think, if the process listens to kill -3, should be better, right?&lt;BR /&gt;Well, early bird catches the worm. I was thinking to long. ;-) grumble mumble..&lt;BR /&gt;&lt;BR /&gt;greetings,&lt;BR /&gt;&lt;BR /&gt;Michael&lt;BR /&gt;</description>
      <pubDate>Wed, 12 Nov 2003 11:36:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/kill-shell-script/m-p/3117200#M150005</guid>
      <dc:creator>Michael Schulte zur Sur</dc:creator>
      <dc:date>2003-11-12T11:36:24Z</dc:date>
    </item>
    <item>
      <title>Re: kill shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/kill-shell-script/m-p/3117201#M150006</link>
      <description>Michael,&lt;BR /&gt;&lt;BR /&gt;What I think is that when I'm shutting down, I don't care what happens to the process.  I don't care if it shuts down gracefully and release any memory regions and cleans up after itself.  I'm shutting down, not worrying about etiquette or hurting a process's feelings.  I want the damn thing to die and die now.&lt;BR /&gt;&lt;BR /&gt;Other processes (like the database, for example) I obviously want to shut down normally but trivial ones like this I don't care about.  The whole point here was to answer Brent's original question about getting the PID.&lt;BR /&gt;&lt;BR /&gt;End of subject - please.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Pete</description>
      <pubDate>Wed, 12 Nov 2003 11:44:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/kill-shell-script/m-p/3117201#M150006</guid>
      <dc:creator>Pete Randall</dc:creator>
      <dc:date>2003-11-12T11:44:05Z</dc:date>
    </item>
    <item>
      <title>Re: kill shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/kill-shell-script/m-p/3117202#M150007</link>
      <description>Hi Pete,&lt;BR /&gt;&lt;BR /&gt;I totally agree with you. It doesnt matter. I am talking about ending a process which is running in the backgound and stopping it with -9 might hurt in cases like disk defrag. That was not meant to critisize you in any way. ;-)&lt;BR /&gt;&lt;BR /&gt;Michael&lt;BR /&gt;</description>
      <pubDate>Wed, 12 Nov 2003 11:47:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/kill-shell-script/m-p/3117202#M150007</guid>
      <dc:creator>Michael Schulte zur Sur</dc:creator>
      <dc:date>2003-11-12T11:47:32Z</dc:date>
    </item>
    <item>
      <title>Re: kill shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/kill-shell-script/m-p/3117203#M150008</link>
      <description>--------------------------------------------------------------------------------&lt;BR /&gt;If you want to kill all processes related to a specific user we set up the following.. &lt;BR /&gt;&lt;BR /&gt;# killit /usr/local/bin/killit &lt;BR /&gt;# ESU#3 - Systems and Networking &lt;BR /&gt;# rcm(10/03/2001) &lt;BR /&gt;# this script was written to kill hung users &lt;BR /&gt;#&lt;BR /&gt;#==============================================&lt;BR /&gt;# BEGIN SCRIPT &lt;BR /&gt;ps -ef |grep -v -f /usr/local/bin/patt.1 |grep $1 &amp;gt; temp.1&lt;BR /&gt;kill -9 `awk '{print $2}' temp.1`&lt;BR /&gt;rm temp.1&lt;BR /&gt;# END SCRIPT &lt;BR /&gt;#==============================================&lt;BR /&gt;&lt;BR /&gt;note ** /usr/local/bin/patt.1 file contains patterns that you want to avoid. it allows you to exclude items that you want to avoid killing.. &lt;BR /&gt;</description>
      <pubDate>Thu, 13 Nov 2003 09:36:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/kill-shell-script/m-p/3117203#M150008</guid>
      <dc:creator>rmueller58</dc:creator>
      <dc:date>2003-11-13T09:36:46Z</dc:date>
    </item>
  </channel>
</rss>

