<?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: killing process pid with a script  ??? in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/killing-process-pid-with-a-script/m-p/2476886#M17673</link>
    <description>Richard,&lt;BR /&gt;&lt;BR /&gt;This is actually a very simple process.  Attached is a script that will look for "program_name" and kill it's process id.  If this is running from something like cron, you might want to source the /etc/profile in the script to set up the correct environment.&lt;BR /&gt;&lt;BR /&gt;Josef</description>
    <pubDate>Wed, 27 Dec 2000 18:01:31 GMT</pubDate>
    <dc:creator>Josef Nordtome</dc:creator>
    <dc:date>2000-12-27T18:01:31Z</dc:date>
    <item>
      <title>killing process pid with a script  ???</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/killing-process-pid-with-a-script/m-p/2476883#M17670</link>
      <description>How would I go about writing a script that will kill a PID. The issue is the PID is always different so when I write this script is there a way it can pick out what the pid is if I write the name of the process ? Or is there any other suggestions ?&lt;BR /&gt;</description>
      <pubDate>Wed, 27 Dec 2000 17:39:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/killing-process-pid-with-a-script/m-p/2476883#M17670</guid>
      <dc:creator>someone_4</dc:creator>
      <dc:date>2000-12-27T17:39:43Z</dc:date>
    </item>
    <item>
      <title>Re: killing process pid with a script  ???</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/killing-process-pid-with-a-script/m-p/2476884#M17671</link>
      <description>Richard,&lt;BR /&gt;There are a couple of ways you can do it, and I have done at least 2 of them! One way is to store the pid in a temp file on start-up of the process, then when you're ready to kill it, you just grap the contents of that temp file.  Another way is using ps, grepping for what you want and don't want, and then using awk to strip out just the PPID (parent process id).  If you need samples, let me know.&lt;BR /&gt;HTH,&lt;BR /&gt;Mo</description>
      <pubDate>Wed, 27 Dec 2000 17:51:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/killing-process-pid-with-a-script/m-p/2476884#M17671</guid>
      <dc:creator>Maureen Gunkel</dc:creator>
      <dc:date>2000-12-27T17:51:56Z</dc:date>
    </item>
    <item>
      <title>Re: killing process pid with a script  ???</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/killing-process-pid-with-a-script/m-p/2476885#M17672</link>
      <description>yes an example would be great .. &lt;BR /&gt;thanks</description>
      <pubDate>Wed, 27 Dec 2000 17:56:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/killing-process-pid-with-a-script/m-p/2476885#M17672</guid>
      <dc:creator>someone_4</dc:creator>
      <dc:date>2000-12-27T17:56:29Z</dc:date>
    </item>
    <item>
      <title>Re: killing process pid with a script  ???</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/killing-process-pid-with-a-script/m-p/2476886#M17673</link>
      <description>Richard,&lt;BR /&gt;&lt;BR /&gt;This is actually a very simple process.  Attached is a script that will look for "program_name" and kill it's process id.  If this is running from something like cron, you might want to source the /etc/profile in the script to set up the correct environment.&lt;BR /&gt;&lt;BR /&gt;Josef</description>
      <pubDate>Wed, 27 Dec 2000 18:01:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/killing-process-pid-with-a-script/m-p/2476886#M17673</guid>
      <dc:creator>Josef Nordtome</dc:creator>
      <dc:date>2000-12-27T18:01:31Z</dc:date>
    </item>
    <item>
      <title>Re: killing process pid with a script  ???</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/killing-process-pid-with-a-script/m-p/2476887#M17674</link>
      <description>Here you go - - -</description>
      <pubDate>Wed, 27 Dec 2000 18:05:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/killing-process-pid-with-a-script/m-p/2476887#M17674</guid>
      <dc:creator>Maureen Gunkel</dc:creator>
      <dc:date>2000-12-27T18:05:28Z</dc:date>
    </item>
    <item>
      <title>Re: killing process pid with a script  ???</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/killing-process-pid-with-a-script/m-p/2476888#M17675</link>
      <description>Hi Richard,&lt;BR /&gt;Try this script: &lt;BR /&gt;ee=`ps -e | grep process_name |cut -c2-6`&lt;BR /&gt;kill -9 $ee&lt;BR /&gt;If it is a rogue process try:&lt;BR /&gt;ee=`ps -e|grep process_name | grep "?" |cut -c2-6`&lt;BR /&gt;kill -9 $ee&lt;BR /&gt;</description>
      <pubDate>Wed, 27 Dec 2000 18:30:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/killing-process-pid-with-a-script/m-p/2476888#M17675</guid>
      <dc:creator>CHRIS_ANORUO</dc:creator>
      <dc:date>2000-12-27T18:30:18Z</dc:date>
    </item>
    <item>
      <title>Re: killing process pid with a script  ???</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/killing-process-pid-with-a-script/m-p/2476889#M17676</link>
      <description>It's easy to grep through ps output and locate processes with a string but it is very UNSAFE. Be sure to limit the output of ps to just the PID, PPID (if needed) and the command (not the command line, aka, arg in ps). Then it's important to get rid of the grep command itself since grep &lt;STRING&gt; is also a process and it will often find itself.&lt;BR /&gt;&lt;BR /&gt;Another problem is that the program you are looking for may have a short name which is part of another program's name as in: myprocess and myprocess2 and myprocess3.  If you kill all processes called "myprocess", you'll also kill myprocess1 and myprocess2.&lt;BR /&gt;&lt;BR /&gt;It's also important to handle the multiple occurances of the same program...do you want to kill avery occurance or just the first one you find or the one with the oldest start time...?&lt;BR /&gt;&lt;BR /&gt;The example script that Maureen posted shows a great feature in ps, the -o option. But this will not work (see than man page) unless you set the ENV variable called UNIX95.  Since UNIX95 set in the environment also affects *many* other processes *and* libraries, it's not advisable to globally set this variable. Instead, set it just for the ps command as in:&lt;BR /&gt;&lt;BR /&gt;UNIX95= ps -e -o 'pid,ppid,comm' &lt;BR /&gt;&lt;BR /&gt;It's a good idea to put the word: echo in front of the kill commands while you are testing the script.  That way, you'll see what the script will do before it's too late.  Be sure to trap any process owned by root and don't kill it!&lt;/STRING&gt;</description>
      <pubDate>Wed, 27 Dec 2000 18:57:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/killing-process-pid-with-a-script/m-p/2476889#M17676</guid>
      <dc:creator>Bill Hassell</dc:creator>
      <dc:date>2000-12-27T18:57:44Z</dc:date>
    </item>
    <item>
      <title>Re: killing process pid with a script  ???</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/killing-process-pid-with-a-script/m-p/2476890#M17677</link>
      <description>Bill-&lt;BR /&gt;Good points! The scripts I submitted were actually for a Sun box, and I forgot that I had to set the UNIX95 variable first for HP. Also a great point on the 'echo kill', that's what I always do while testing!&lt;BR /&gt;Mo</description>
      <pubDate>Wed, 27 Dec 2000 19:22:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/killing-process-pid-with-a-script/m-p/2476890#M17677</guid>
      <dc:creator>Maureen Gunkel</dc:creator>
      <dc:date>2000-12-27T19:22:33Z</dc:date>
    </item>
    <item>
      <title>Re: killing process pid with a script  ???</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/killing-process-pid-with-a-script/m-p/2476891#M17678</link>
      <description>all of your answers were great ! &lt;BR /&gt;I want to thank everyone for your help..&lt;BR /&gt;I tried to give everyone a 10 but it didnt let me. &lt;BR /&gt;thanks allot guys. &lt;BR /&gt;case closed.</description>
      <pubDate>Wed, 27 Dec 2000 19:46:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/killing-process-pid-with-a-script/m-p/2476891#M17678</guid>
      <dc:creator>someone_4</dc:creator>
      <dc:date>2000-12-27T19:46:24Z</dc:date>
    </item>
  </channel>
</rss>

