<?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 I'm looking for a perl script to kill a process in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/i-m-looking-for-a-perl-script-to-kill-a-process/m-p/3589620#M231122</link>
    <description>hi&lt;BR /&gt;&lt;BR /&gt;has someone a perl script to look if a process&lt;BR /&gt;is running and if it is, then kill it ?&lt;BR /&gt;&lt;BR /&gt;kind regards&lt;BR /&gt;chris</description>
    <pubDate>Mon, 25 Jul 2005 16:51:20 GMT</pubDate>
    <dc:creator>'chris'</dc:creator>
    <dc:date>2005-07-25T16:51:20Z</dc:date>
    <item>
      <title>I'm looking for a perl script to kill a process</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/i-m-looking-for-a-perl-script-to-kill-a-process/m-p/3589620#M231122</link>
      <description>hi&lt;BR /&gt;&lt;BR /&gt;has someone a perl script to look if a process&lt;BR /&gt;is running and if it is, then kill it ?&lt;BR /&gt;&lt;BR /&gt;kind regards&lt;BR /&gt;chris</description>
      <pubDate>Mon, 25 Jul 2005 16:51:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/i-m-looking-for-a-perl-script-to-kill-a-process/m-p/3589620#M231122</guid>
      <dc:creator>'chris'</dc:creator>
      <dc:date>2005-07-25T16:51:20Z</dc:date>
    </item>
    <item>
      <title>Re: I'm looking for a perl script to kill a process</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/i-m-looking-for-a-perl-script-to-kill-a-process/m-p/3589621#M231123</link>
      <description>perl can call system functions, so something like this should be able to kill anything matching the "PATTERN" in ps -ef output.&lt;BR /&gt;&lt;BR /&gt;perl -e '$cc = system("ps -ef|grep PATTERN|grep -v grep| awk {'print $2'}|xargs kill"); exit($cc);'&lt;BR /&gt;&lt;BR /&gt;take it with a lot of salt as I am not an expert in PERL programming. Know just nuff to get myself in trouble.&lt;BR /&gt;</description>
      <pubDate>Mon, 25 Jul 2005 17:41:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/i-m-looking-for-a-perl-script-to-kill-a-process/m-p/3589621#M231123</guid>
      <dc:creator>Mel Burslan</dc:creator>
      <dc:date>2005-07-25T17:41:27Z</dc:date>
    </item>
    <item>
      <title>Re: I'm looking for a perl script to kill a process</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/i-m-looking-for-a-perl-script-to-kill-a-process/m-p/3589622#M231124</link>
      <description>Hi Chris,&lt;BR /&gt; &lt;BR /&gt;maybe the best (most Perlish) option would be if you installed Proc::ProcessTable from CPAN.&lt;BR /&gt;&lt;A href="http://search.cpan.org/~durist/Proc-ProcessTable-0.40/ProcessTable.pm" target="_blank"&gt;http://search.cpan.org/~durist/Proc-ProcessTable-0.40/ProcessTable.pm&lt;/A&gt;&lt;BR /&gt; &lt;BR /&gt;With this module you can scan your system's process table at your heart's content without having to call external programs like ps.&lt;BR /&gt; &lt;BR /&gt;e.g.&lt;BR /&gt; &lt;BR /&gt;Here I retrieve the PID of the dsmc process (i.e. ADMS client)&lt;BR /&gt; &lt;BR /&gt;  &lt;BR /&gt;$ perl -MProc::ProcessTable -le '$pid=(grep $_-&amp;gt;{cmd}=~/dsmc/,@{Proc::ProcessTable-&amp;gt;new-&amp;gt;table})[0]-&amp;gt;{pid};print$pid'&lt;BR /&gt; &lt;BR /&gt; &lt;BR /&gt;Instead of printing you would send it any signal.&lt;BR /&gt;You can use Perl's built-in kill() function to this end.&lt;BR /&gt; &lt;BR /&gt;e.g.&lt;BR /&gt; &lt;BR /&gt;kill 15 =&amp;gt; $pid;&lt;BR /&gt; &lt;BR /&gt;To send it a SIGTERM.&lt;BR /&gt;You can send a whole bunch of processes (you have retrieved from the proc table before) a signal in one go if you pass kill() a list of PIDs.&lt;BR /&gt; &lt;BR /&gt;See "perldoc -f kill"&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 26 Jul 2005 04:17:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/i-m-looking-for-a-perl-script-to-kill-a-process/m-p/3589622#M231124</guid>
      <dc:creator>Ralph Grothe</dc:creator>
      <dc:date>2005-07-26T04:17:19Z</dc:date>
    </item>
    <item>
      <title>Re: I'm looking for a perl script to kill a process</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/i-m-looking-for-a-perl-script-to-kill-a-process/m-p/3589623#M231125</link>
      <description>Oh forgot,&lt;BR /&gt;if you want to avoid the hassle of installing the extra Proc::ProcessTable you can of course also hand the parsing over to the external ps command.&lt;BR /&gt; &lt;BR /&gt;e.g.&lt;BR /&gt; &lt;BR /&gt;$ perl -le 'chomp($pid=qx(UNIX95= /usr/bin/ps -o pid= -C dsmc));print$pid'&lt;BR /&gt;13557&lt;BR /&gt;</description>
      <pubDate>Tue, 26 Jul 2005 04:21:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/i-m-looking-for-a-perl-script-to-kill-a-process/m-p/3589623#M231125</guid>
      <dc:creator>Ralph Grothe</dc:creator>
      <dc:date>2005-07-26T04:21:31Z</dc:date>
    </item>
    <item>
      <title>Re: I'm looking for a perl script to kill a process</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/i-m-looking-for-a-perl-script-to-kill-a-process/m-p/3589624#M231126</link>
      <description>Why you are trying to put a shell line into a perl or writing a perl code and executing it in shell prompt. Try simply in the command line itself as,&lt;BR /&gt;&lt;BR /&gt; kill -9 `ps -ef | grep 'PATTERN' | awk '!/grep/ { print $2 }'`&lt;BR /&gt;&lt;BR /&gt; or &lt;BR /&gt;&lt;BR /&gt; PID=$(ps -ef | grep -v grep | grep -q 'PATTERN')&lt;BR /&gt; if [[ $PID != "" ]]&lt;BR /&gt; then&lt;BR /&gt;   kill -15 $PID&lt;BR /&gt; fi&lt;BR /&gt;&lt;BR /&gt;hth.</description>
      <pubDate>Tue, 26 Jul 2005 05:26:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/i-m-looking-for-a-perl-script-to-kill-a-process/m-p/3589624#M231126</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2005-07-26T05:26:10Z</dc:date>
    </item>
    <item>
      <title>Re: I'm looking for a perl script to kill a process</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/i-m-looking-for-a-perl-script-to-kill-a-process/m-p/3589625#M231127</link>
      <description>Mel, though that *lloks* like perl, it in fact is just a perl wrapper around one single system command, one that calls grep and awk. Urgh!&lt;BR /&gt;&lt;BR /&gt;*IF* you use backticked ps (or system ()), *PLEASE* use perl's builtin functions to process further&lt;BR /&gt;&lt;BR /&gt;# perl -e 'kill 15,map{m/^\s*\w+\s+(\d+)/;$1}grep/pattern/,`ps -ef`'&lt;BR /&gt;&lt;BR /&gt;Enjoy, Have FUN! H.Merijn</description>
      <pubDate>Tue, 26 Jul 2005 06:34:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/i-m-looking-for-a-perl-script-to-kill-a-process/m-p/3589625#M231127</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2005-07-26T06:34:29Z</dc:date>
    </item>
    <item>
      <title>Re: I'm looking for a perl script to kill a process</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/i-m-looking-for-a-perl-script-to-kill-a-process/m-p/3589626#M231128</link>
      <description>I've said it before, I'll say it again.&lt;BR /&gt;Perls are nice, ksh is a gem:o)&lt;BR /&gt;&lt;BR /&gt;I wrote the attached script some time ago to repeatedly kill self-respawning processes that were running amok &amp;amp; getting in the way.&lt;BR /&gt;&lt;BR /&gt;It works, and is well commented, but do please read the warning.&lt;BR /&gt;&lt;BR /&gt;Share And Enjoy</description>
      <pubDate>Tue, 26 Jul 2005 08:38:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/i-m-looking-for-a-perl-script-to-kill-a-process/m-p/3589626#M231128</guid>
      <dc:creator>Gordon  Morrison</dc:creator>
      <dc:date>2005-07-26T08:38:48Z</dc:date>
    </item>
    <item>
      <title>Re: I'm looking for a perl script to kill a process</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/i-m-looking-for-a-perl-script-to-kill-a-process/m-p/3589627#M231129</link>
      <description>thanks to ALL&lt;BR /&gt;&lt;BR /&gt;@prokura&lt;BR /&gt;" *IF* you use backticked ps (or system ()), *PLEASE* use perl's builtin functions to process further "&lt;BR /&gt;&lt;BR /&gt;can you pls give more details ?&lt;BR /&gt;&lt;BR /&gt;and this won't work on my system running as root from command line:&lt;BR /&gt;&lt;BR /&gt;# perl -e 'kill 15,map{m/^\s*\w+\s+(\d+)/;$1}grep/ntop/,`ps -ef`'&lt;BR /&gt;ps: Process environment requires procfs(5)&lt;BR /&gt;&lt;BR /&gt;or do I something wrong ?&lt;BR /&gt;</description>
      <pubDate>Thu, 28 Jul 2005 17:24:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/i-m-looking-for-a-perl-script-to-kill-a-process/m-p/3589627#M231129</guid>
      <dc:creator>'chris'</dc:creator>
      <dc:date>2005-07-28T17:24:27Z</dc:date>
    </item>
    <item>
      <title>Re: I'm looking for a perl script to kill a process</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/i-m-looking-for-a-perl-script-to-kill-a-process/m-p/3589628#M231130</link>
      <description>Hm, procfs to my knowing is typically Linux&lt;BR /&gt;(or Solaris, albeit a bit more limitted).&lt;BR /&gt;Are you trying this on a Linux box?&lt;BR /&gt;This should also explain your usage of killall in another of your threads.&lt;BR /&gt;Btw, have you noticed that ITRC also maintains a Linux forum?&lt;BR /&gt;Chances for a satisfactory answer there might be higher.</description>
      <pubDate>Thu, 28 Jul 2005 23:46:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/i-m-looking-for-a-perl-script-to-kill-a-process/m-p/3589628#M231130</guid>
      <dc:creator>Ralph Grothe</dc:creator>
      <dc:date>2005-07-28T23:46:26Z</dc:date>
    </item>
  </channel>
</rss>

