<?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: related process in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/related-process/m-p/4112808#M313561</link>
    <description>ps -ef | grep &lt;PROCESS name=""&gt; | awk '{print $2,$3}' |while read line&lt;BR /&gt;kill -9 $pids&lt;BR /&gt;&lt;BR /&gt;be carefull killing parents, is this realy wat you want?&lt;/PROCESS&gt;</description>
    <pubDate>Thu, 06 Dec 2007 14:51:24 GMT</pubDate>
    <dc:creator>F Verschuren</dc:creator>
    <dc:date>2007-12-06T14:51:24Z</dc:date>
    <item>
      <title>related process</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/related-process/m-p/4112806#M313559</link>
      <description>I have the below script that kill the process in the file /tmp/process.list &lt;BR /&gt;&lt;BR /&gt;for i in `ls -l /tmp/process.list`&lt;BR /&gt;do&lt;BR /&gt;kill $i &lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;the file is as below.&lt;BR /&gt;$vi /tmp/process.list&lt;BR /&gt;58245&lt;BR /&gt;55874&lt;BR /&gt;5842  &lt;BR /&gt;58745  &amp;lt; -- all these are process &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;now , I not only want to kill the process in this list , I also want kill the related process ( all its child and parent process ) , I know I can find the process by "ps -ef" , can advise how to add "ps -ef" to my above script so that the related process can be killed ? &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;thx&lt;BR /&gt;</description>
      <pubDate>Thu, 06 Dec 2007 13:16:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/related-process/m-p/4112806#M313559</guid>
      <dc:creator>ust3</dc:creator>
      <dc:date>2007-12-06T13:16:31Z</dc:date>
    </item>
    <item>
      <title>Re: related process</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/related-process/m-p/4112807#M313560</link>
      <description>hi,&lt;BR /&gt;&lt;BR /&gt;did you try:&lt;BR /&gt;&lt;BR /&gt;pids=$(ps -ef | grep &lt;PROCESS name=""&gt; |  awk '{print $2}')&lt;BR /&gt;kill -9 $pids&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;kind regards&lt;BR /&gt;yogeeraj&lt;BR /&gt;&lt;/PROCESS&gt;</description>
      <pubDate>Thu, 06 Dec 2007 13:24:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/related-process/m-p/4112807#M313560</guid>
      <dc:creator>Yogeeraj_1</dc:creator>
      <dc:date>2007-12-06T13:24:32Z</dc:date>
    </item>
    <item>
      <title>Re: related process</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/related-process/m-p/4112808#M313561</link>
      <description>ps -ef | grep &lt;PROCESS name=""&gt; | awk '{print $2,$3}' |while read line&lt;BR /&gt;kill -9 $pids&lt;BR /&gt;&lt;BR /&gt;be carefull killing parents, is this realy wat you want?&lt;/PROCESS&gt;</description>
      <pubDate>Thu, 06 Dec 2007 14:51:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/related-process/m-p/4112808#M313561</guid>
      <dc:creator>F Verschuren</dc:creator>
      <dc:date>2007-12-06T14:51:24Z</dc:date>
    </item>
    <item>
      <title>Re: related process</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/related-process/m-p/4112809#M313562</link>
      <description>you can try this one if the echo looks like what you want you can remove it to thave the real kills...&lt;BR /&gt;&lt;BR /&gt;for i in `ls -l /tmp/process.list`&lt;BR /&gt;do&lt;BR /&gt;for x in ` ps -ef | grep $i | awk '{print $2, $3}' `&lt;BR /&gt;do&lt;BR /&gt;echo kill $x&lt;BR /&gt;done&lt;BR /&gt;done</description>
      <pubDate>Thu, 06 Dec 2007 14:56:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/related-process/m-p/4112809#M313562</guid>
      <dc:creator>F Verschuren</dc:creator>
      <dc:date>2007-12-06T14:56:32Z</dc:date>
    </item>
    <item>
      <title>Re: related process</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/related-process/m-p/4112810#M313563</link>
      <description>one more safty to make sure you ps does not find a part of a proces numbre:&lt;BR /&gt;&lt;BR /&gt;for i in `ls -l /tmp/process.list`&lt;BR /&gt;do&lt;BR /&gt;for x in ` ps -ef | grep " "$i" " | awk '{print $2, $3}' `&lt;BR /&gt;do&lt;BR /&gt;echo kill $x&lt;BR /&gt;done&lt;BR /&gt;done</description>
      <pubDate>Thu, 06 Dec 2007 17:37:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/related-process/m-p/4112810#M313563</guid>
      <dc:creator>F Verschuren</dc:creator>
      <dc:date>2007-12-06T17:37:07Z</dc:date>
    </item>
    <item>
      <title>Re: related process</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/related-process/m-p/4112811#M313564</link>
      <description>Little modification&lt;BR /&gt;&lt;BR /&gt;for psid in `cat /tmp/process.list`&lt;BR /&gt;do&lt;BR /&gt;  for psids in `ps -ef | grep $psid | awk '{ print $2, $3 }'`&lt;BR /&gt;  do&lt;BR /&gt;    kill -9 $psids&lt;BR /&gt;  done&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Rgds&lt;BR /&gt;-NKG-</description>
      <pubDate>Fri, 07 Dec 2007 06:52:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/related-process/m-p/4112811#M313564</guid>
      <dc:creator>Nitin Kumar Gupta</dc:creator>
      <dc:date>2007-12-07T06:52:25Z</dc:date>
    </item>
    <item>
      <title>Re: related process</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/related-process/m-p/4112812#M313565</link>
      <description>Some times parent dies and new parent of that proxesses become init processes.&lt;BR /&gt;So pls be care full while running this as this could kill ur init process.&lt;BR /&gt;And a small mistake could be fatel.&lt;BR /&gt;Or add "grep -v init" in above solutions.&lt;BR /&gt;BR,&lt;BR /&gt;Kapil</description>
      <pubDate>Fri, 07 Dec 2007 07:09:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/related-process/m-p/4112812#M313565</guid>
      <dc:creator>Kapil Jha</dc:creator>
      <dc:date>2007-12-07T07:09:18Z</dc:date>
    </item>
    <item>
      <title>Re: related process</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/related-process/m-p/4112813#M313566</link>
      <description>&lt;!--!*#--&gt;&amp;gt;I know I can find the process by "ps -ef"&lt;BR /&gt;&lt;BR /&gt;You can find the one process by: ps -fp PID&lt;BR /&gt;&lt;BR /&gt;Kapil: So pls be careful while running this as this could kill your init process.&lt;BR /&gt;&lt;BR /&gt;It won't let you cut your throat, kill(2):&lt;BR /&gt;pid can equal 1 unless sig is SIGKILL or SIGSTOP.&lt;BR /&gt;&lt;BR /&gt;So it is init's job to handle the other signals.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;F Verschuren: one more safety to make sure your ps does not find a part of a process number:&lt;BR /&gt;&lt;BR /&gt;Probably something like this:&lt;BR /&gt;for pid in $(&amp;lt; /tmp/process.list) ; do&lt;BR /&gt;   echo kill $(UNIX95= ps -e -o pid= -o ppid= | grep -w $pid)&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;This won't kill any deeper than the child.</description>
      <pubDate>Fri, 07 Dec 2007 08:40:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/related-process/m-p/4112813#M313566</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-12-07T08:40:06Z</dc:date>
    </item>
    <item>
      <title>Re: related process</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/related-process/m-p/4112814#M313567</link>
      <description>thx replies,&lt;BR /&gt;&lt;BR /&gt;I think the below is fine , as your advice , I have two problem when kill the process , can help to advise the solution ,&lt;BR /&gt;&lt;BR /&gt;1. if use the script to check other related process , I am afraid it will kill the process that init id is 1 or 0 , I think this is system process and should not be killed , can advise how to avoid this kind of process to be killed ? how to change the script to avoid kill this kind of process ?&lt;BR /&gt;&lt;BR /&gt;2. As this script is run by user themself , if they killed process in /tmp/process.list , so they have killed the current login , so they can't kill the related process , can advise how to make sure they can kill the related process first ? Thx.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;or psid in `cat /tmp/process.list`&lt;BR /&gt;do&lt;BR /&gt;for psids in `ps -ef | grep $psid | awk '{ print $2, $3 }'`&lt;BR /&gt;do&lt;BR /&gt;kill -9 $psids&lt;BR /&gt;done&lt;BR /&gt;done&lt;BR /&gt;</description>
      <pubDate>Wed, 12 Dec 2007 01:08:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/related-process/m-p/4112814#M313567</guid>
      <dc:creator>ust3</dc:creator>
      <dc:date>2007-12-12T01:08:45Z</dc:date>
    </item>
    <item>
      <title>Re: related process</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/related-process/m-p/4112815#M313568</link>
      <description>&lt;!--!*#--&gt;&amp;gt;1. if use the script to check other related process, I am afraid it will kill the process that init id is 1 or 0&lt;BR /&gt;&lt;BR /&gt;I mentioned this can't happen for init.  (You might want to test this on a test system first. :-)&lt;BR /&gt;&lt;BR /&gt;&amp;gt;2. As this script is run by user themselves, ..., can advise how to make sure they can kill the related process first?&lt;BR /&gt;&lt;BR /&gt;Go back to my nohup suggestion:&lt;BR /&gt;&lt;A href="http://forums12.itrc.hp.com/service/forums/questionanswer.do?threadId=1181073" target="_blank"&gt;http://forums12.itrc.hp.com/service/forums/questionanswer.do?threadId=1181073&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Then take my suggestion and wrap it another $() and do one single kill:&lt;BR /&gt;nohup echo kill $(for pid in $(&amp;lt; /tmp/process.list) ; do&lt;BR /&gt;   UNIX95= ps -e -o pid= -o ppid= | grep -w $pid&lt;BR /&gt;done)&lt;BR /&gt;&lt;BR /&gt;Remove echo after you have checked it. You can check by:&lt;BR /&gt;$ xargs -n1 ps -fp &amp;lt; nohup.out | grep -v COMMAND | sort -u&lt;BR /&gt;(Ignore "ps: wrong PID number kill".)&lt;BR /&gt;&lt;BR /&gt;(Remove echo after you have checked it.)&lt;BR /&gt;</description>
      <pubDate>Wed, 12 Dec 2007 02:41:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/related-process/m-p/4112815#M313568</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-12-12T02:41:14Z</dc:date>
    </item>
    <item>
      <title>Re: related process</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/related-process/m-p/4112816#M313569</link>
      <description>thx reply ,&lt;BR /&gt;&lt;BR /&gt;Sorry to my stupid , the below script is OK , but I still have  question , the psid is only child process of pid , so from the below result , $3 is the pid ( 31694)&lt;BR /&gt;&lt;BR /&gt;the script :&lt;BR /&gt;or psid in `cat /tmp/process.list`&lt;BR /&gt;do&lt;BR /&gt;for psids in `ps -ef | grep $psid | awk '{ print $2, $3 }'`&lt;BR /&gt;do&lt;BR /&gt;kill -9 $psids&lt;BR /&gt;done&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;the result&lt;BR /&gt;31697 31694&lt;BR /&gt;1548 29714&lt;BR /&gt;&lt;BR /&gt;but what I want to kill is ppid , I can find it by ps -ef | grep 31694 | awk '{ print $2, $3 }'` ,  this $3 is the ppid , if I want to kill this $3 , can advise how can I change the script ? Thx&lt;BR /&gt;</description>
      <pubDate>Thu, 13 Dec 2007 09:38:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/related-process/m-p/4112816#M313569</guid>
      <dc:creator>ust3</dc:creator>
      <dc:date>2007-12-13T09:38:04Z</dc:date>
    </item>
    <item>
      <title>Re: related process</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/related-process/m-p/4112817#M313570</link>
      <description>Actually , I want to kill BOT pid and ppid . Thx</description>
      <pubDate>Thu, 13 Dec 2007 09:43:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/related-process/m-p/4112817#M313570</guid>
      <dc:creator>ust3</dc:creator>
      <dc:date>2007-12-13T09:43:14Z</dc:date>
    </item>
    <item>
      <title>Re: related process</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/related-process/m-p/4112818#M313571</link>
      <description>sorry , I mean BOTH pid and ppid</description>
      <pubDate>Thu, 13 Dec 2007 09:56:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/related-process/m-p/4112818#M313571</guid>
      <dc:creator>ust3</dc:creator>
      <dc:date>2007-12-13T09:56:46Z</dc:date>
    </item>
    <item>
      <title>Re: related process</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/related-process/m-p/4112819#M313572</link>
      <description>&amp;gt;but I still have question, the psid is only child process of pid, so from the below result, $3 is the pid (31694)&lt;BR /&gt;&lt;BR /&gt;You're going to have to have a picture.  You need to explain why you think your script doesn't work.&lt;BR /&gt;&lt;BR /&gt;Your script will kill the list of PIDs.  And it will also kill their children and their parent.&lt;BR /&gt;&lt;BR /&gt;It does that by first finding PID in PID field, and then killing both PID and PPID.  If it finds in in the PPID field, it kills child and the PID again.  (I assumed you didn't care that you killed some twice.)&lt;BR /&gt;&lt;BR /&gt;So since I think it does what you want, you will need to explain what's missing by an example.&lt;BR /&gt;&lt;BR /&gt;Note: should really be using my for/UNIX95= ps solution that correctly "greps" and even Bill will be happy.  :-)&lt;BR /&gt;&lt;BR /&gt;Basically use my script and that xargs checking script.</description>
      <pubDate>Thu, 13 Dec 2007 10:35:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/related-process/m-p/4112819#M313572</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-12-13T10:35:02Z</dc:date>
    </item>
    <item>
      <title>Re: related process</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/related-process/m-p/4112820#M313573</link>
      <description>thx reply,&lt;BR /&gt;&lt;BR /&gt;You're going to have to have a picture. You need to explain why you think your script doesn't work.&lt;BR /&gt;--&amp;gt; the reason is the /tmp/process.list , the process id (58245,55874,5842,58745) in this file is not a pid , I can use the script to find the pid , and now want to have another script to find the ppid , the /tmp/process.list is generated from the another script .</description>
      <pubDate>Thu, 13 Dec 2007 12:30:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/related-process/m-p/4112820#M313573</guid>
      <dc:creator>ust3</dc:creator>
      <dc:date>2007-12-13T12:30:04Z</dc:date>
    </item>
    <item>
      <title>Re: related process</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/related-process/m-p/4112821#M313574</link>
      <description>&lt;!--!*#--&gt;&amp;gt;the reason is the /tmp/process.list, the process id (58245,55874,5842,58745) in this file is not a pid&lt;BR /&gt;&lt;BR /&gt;PIDs are PIDs.  :-)&lt;BR /&gt;&lt;BR /&gt;&amp;gt;now want to have another script to find the ppid&lt;BR /&gt;&lt;BR /&gt;To find a list of PPIDs for each PID in that file:&lt;BR /&gt;for pid in $(&amp;lt; /tmp/process.list); do&lt;BR /&gt;   UNIX95= ps -p $pid -o ppid=&lt;BR /&gt;done</description>
      <pubDate>Thu, 13 Dec 2007 12:38:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/related-process/m-p/4112821#M313574</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-12-13T12:38:39Z</dc:date>
    </item>
    <item>
      <title>Re: related process</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/related-process/m-p/4112822#M313575</link>
      <description>thx reply again,&lt;BR /&gt;&lt;BR /&gt;Your script can find the ppid , it is OK.&lt;BR /&gt;&lt;BR /&gt;for pid in $(&amp;lt; /tmp/process.list); do&lt;BR /&gt;   UNIX95= ps -p $pid -o ppid=&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;But if I want to find the parent id of this ppid , can advise what can i do ? thx&lt;BR /&gt;&lt;BR /&gt;ps. what I actucally want is the parent id of ppid in the /tmp/process.list .</description>
      <pubDate>Fri, 14 Dec 2007 01:04:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/related-process/m-p/4112822#M313575</guid>
      <dc:creator>ust3</dc:creator>
      <dc:date>2007-12-14T01:04:58Z</dc:date>
    </item>
    <item>
      <title>Re: related process</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/related-process/m-p/4112823#M313576</link>
      <description>&lt;!--!*#--&gt;&amp;gt;But if I want to find the parent id of this ppid, can advise what can i do?&lt;BR /&gt;&lt;BR /&gt;&amp;gt;what I actually want is the parent id of ppid in the /tmp/process.list.&lt;BR /&gt;&lt;BR /&gt;The file just has PIDs.  I find the PPID of each PID in that file.&lt;BR /&gt;&lt;BR /&gt;If you really want to go back one more:&lt;BR /&gt;for pid in $(&amp;lt; /tmp/process.list); do&lt;BR /&gt;  UNIX95= ps -p $(UNIX95= ps -p $pid -o ppid=) -o ppid=&lt;BR /&gt;done</description>
      <pubDate>Fri, 14 Dec 2007 02:33:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/related-process/m-p/4112823#M313576</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-12-14T02:33:36Z</dc:date>
    </item>
  </channel>
</rss>

