<?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 all processes PHN8 in group where user belongs to in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/kill-all-processes-phn8-in-group-where-user-belongs-to/m-p/4915444#M406840</link>
    <description>Here's one way to introduce shell variables into awk statements.&lt;BR /&gt;&lt;BR /&gt;Change this&lt;BR /&gt;&lt;BR /&gt;UNIX95= ps -o user,group,pid,args -C PH8SRVN |awk '$2=="$GPNAME" {print $0}'&lt;BR /&gt;&lt;BR /&gt;to&lt;BR /&gt;&lt;BR /&gt;UNIX95= ps -o user,group,pid,args -C PH8SRVN |awk -v GROUP=$GPNAME '$2==GROUP {print $0}'</description>
    <pubDate>Thu, 04 Aug 2005 19:32:36 GMT</pubDate>
    <dc:creator>Ermin Borovac</dc:creator>
    <dc:date>2005-08-04T19:32:36Z</dc:date>
    <item>
      <title>Kill all processes PHN8 in group where user belongs to</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/kill-all-processes-phn8-in-group-where-user-belongs-to/m-p/4915433#M406829</link>
      <description>Hi all,&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;ps- ef |grep PHN8 |awk '{print $2}' |xargs /usr/local/bin/sudo kill -9&lt;BR /&gt;&lt;BR /&gt;This script will kill all processes with the name PHN8.&lt;BR /&gt;i would like to modify this script to search for user primary group and only kill&lt;BR /&gt;processes that particular user who run the script belong to.&lt;BR /&gt;Thanks for your help.&lt;BR /&gt;Regards,&lt;BR /&gt;Tom</description>
      <pubDate>Mon, 01 Aug 2005 16:34:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/kill-all-processes-phn8-in-group-where-user-belongs-to/m-p/4915433#M406829</guid>
      <dc:creator>tom quach_1</dc:creator>
      <dc:date>2005-08-01T16:34:55Z</dc:date>
    </item>
    <item>
      <title>Re: Kill all processes PHN8 in group where user belongs to</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/kill-all-processes-phn8-in-group-where-user-belongs-to/m-p/4915434#M406830</link>
      <description>Well for the "group" part - add the use of the "-g" switch of the ps command.&lt;BR /&gt;&lt;BR /&gt;ps -efg "group" | grep ...&lt;BR /&gt;&lt;BR /&gt;and for the user part...&lt;BR /&gt;&lt;BR /&gt;ps -efu "user"  | grep...&lt;BR /&gt;&lt;BR /&gt;also consider&lt;BR /&gt;&lt;BR /&gt;ps -ef -C PHN8 -g "group" -u "user" &lt;BR /&gt;&lt;BR /&gt;should limit you to a select group of users in a certain command group running PHN8 all in one command.&lt;BR /&gt;</description>
      <pubDate>Mon, 01 Aug 2005 16:58:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/kill-all-processes-phn8-in-group-where-user-belongs-to/m-p/4915434#M406830</guid>
      <dc:creator>TwoProc</dc:creator>
      <dc:date>2005-08-01T16:58:56Z</dc:date>
    </item>
    <item>
      <title>Re: Kill all processes PHN8 in group where user belongs to</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/kill-all-processes-phn8-in-group-where-user-belongs-to/m-p/4915435#M406831</link>
      <description>Start by never using grep. grep isn't particular about what it matches so you could find a process like: myproc 8PHN89 and it would match--not a good thing. Start by using all of the ps match options. To do this, you need to turn on the UNIX965 variable just for ps, something like this:&lt;BR /&gt; &lt;BR /&gt;UNIX95= ps -fC PHN8&lt;BR /&gt; &lt;BR /&gt;Now notice that this always finds processes that are exactly "PHN8", no more and no less. Then look at the -g and -u options to further limit the search.&lt;BR /&gt; &lt;BR /&gt;Finally, do NOT use kill -9 as your kill signal. It will always cause problems. Use kill -15 to allow processes to terminate normally and cleanup correctly. &lt;BR /&gt; &lt;BR /&gt;And don't be tempted to seet UNIX95 for everything as in: export UNIX95=. It will change other commands and libraries. Just use as shown above. NOTE: To see the hierarchy of processes (parent/chile), use the -H option with UNIX95=.</description>
      <pubDate>Mon, 01 Aug 2005 17:13:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/kill-all-processes-phn8-in-group-where-user-belongs-to/m-p/4915435#M406831</guid>
      <dc:creator>Bill Hassell</dc:creator>
      <dc:date>2005-08-01T17:13:14Z</dc:date>
    </item>
    <item>
      <title>Re: Kill all processes PHN8 in group where user belongs to</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/kill-all-processes-phn8-in-group-where-user-belongs-to/m-p/4915436#M406832</link>
      <description>&lt;BR /&gt;Thanks for your help.&lt;BR /&gt;&lt;BR /&gt;there are 2 group: IT and PROD&lt;BR /&gt;how can i get the process with user belongs to IT group&lt;BR /&gt;Thanks,&lt;BR /&gt;Tom&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;#UNIX95= ps -fC PH8SRVN -g IT&lt;BR /&gt;ps: wrong session number IT&lt;BR /&gt;UID        PID  PPID  C    STIME TTY          TIME CMD&lt;BR /&gt;chis     21571 21569  0 17:31:57 ?           00:00 /opt/cognos/ph843d/bin/PH8SRVN&lt;BR /&gt;regina   16961 16959  0 17:06:05 ?           00:00 /opt/cognos/ph843d/bin/PH8SRVN&lt;BR /&gt;</description>
      <pubDate>Mon, 01 Aug 2005 19:56:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/kill-all-processes-phn8-in-group-where-user-belongs-to/m-p/4915436#M406832</guid>
      <dc:creator>tom quach_1</dc:creator>
      <dc:date>2005-08-01T19:56:09Z</dc:date>
    </item>
    <item>
      <title>Re: Kill all processes PHN8 in group where user belongs to</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/kill-all-processes-phn8-in-group-where-user-belongs-to/m-p/4915437#M406833</link>
      <description>I think you have to give the numeric id of your group.</description>
      <pubDate>Tue, 02 Aug 2005 01:01:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/kill-all-processes-phn8-in-group-where-user-belongs-to/m-p/4915437#M406833</guid>
      <dc:creator>Vibhor Kumar Agarwal</dc:creator>
      <dc:date>2005-08-02T01:01:08Z</dc:date>
    </item>
    <item>
      <title>Re: Kill all processes PHN8 in group where user belongs to</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/kill-all-processes-phn8-in-group-where-user-belongs-to/m-p/4915438#M406834</link>
      <description>Try as,&lt;BR /&gt;&lt;BR /&gt;#UNIX95= ps -fC PH8SRVN -G IT&lt;BR /&gt;&lt;BR /&gt;hth.</description>
      <pubDate>Tue, 02 Aug 2005 03:05:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/kill-all-processes-phn8-in-group-where-user-belongs-to/m-p/4915438#M406834</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2005-08-02T03:05:26Z</dc:date>
    </item>
    <item>
      <title>Re: Kill all processes PHN8 in group where user belongs to</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/kill-all-processes-phn8-in-group-where-user-belongs-to/m-p/4915439#M406835</link>
      <description>Thanks again for all your input.&lt;BR /&gt;&lt;BR /&gt;below are ids for users "alb" and "chis"&lt;BR /&gt;user alb gid=110(IT)&lt;BR /&gt;user chis gid=105(china&lt;BR /&gt;&lt;BR /&gt;the commands below should return processes belong to group china ONLY but it returned both group china and IT.&lt;BR /&gt;Please how can i fix this.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Tom&lt;BR /&gt;&lt;BR /&gt;#UNIX95= ps -fC PH8SRVN -g china&lt;BR /&gt;#UNIX95= ps -fC PH8SRVN -G china&lt;BR /&gt;&lt;BR /&gt;#id alb&lt;BR /&gt;uid=104(alb) gid=110(IT) groups=20(users),103(dba),105(china)&lt;BR /&gt;sunuxap1:[root]:/&lt;BR /&gt;#id chis&lt;BR /&gt;uid=163(chis) gid=105(china) groups=20(users),110(IT)&lt;BR /&gt;&lt;BR /&gt;#UNIX95= ps -fC PH8SRVN -g china&lt;BR /&gt;ps: wrong session number china&lt;BR /&gt;UID        PID  PPID  C    STIME TTY          TIME CMD&lt;BR /&gt;chis     23045 23043  0 07:48:53 ?           00:00 /opt/cognos/ph843d/bin/PH8SRVN&lt;BR /&gt;albany   23433 23431  0 07:51:09 ?           00:00 /opt/cognos/ph843d/bin/PH8SRVN&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;#UNIX95= ps -fC PH8SRVN -G china&lt;BR /&gt;UID        PID  PPID  C    STIME TTY          TIME CMD&lt;BR /&gt;albany   29214 29212  0 08:25:16 ?           00:00 /opt/cognos/ph843d/bin/PH8SRVN&lt;BR /&gt;chis     29132 29130  0 08:24:51 ?           00:00 /opt/cognos/ph843d/bin/PH8SRVN&lt;BR /&gt;chis     29130  1593  0 08:24:51 ?           00:00 sh -c /opt/cognos/ph843d/bin/PH8INIT /opt/cognos/ph843d/bin/PH8&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 02 Aug 2005 10:37:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/kill-all-processes-phn8-in-group-where-user-belongs-to/m-p/4915439#M406835</guid>
      <dc:creator>tom quach_1</dc:creator>
      <dc:date>2005-08-02T10:37:35Z</dc:date>
    </item>
    <item>
      <title>Re: Kill all processes PHN8 in group where user belongs to</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/kill-all-processes-phn8-in-group-where-user-belongs-to/m-p/4915440#M406836</link>
      <description>Tom, it looks like the ps command is doing a logical "or" function instead of a logical "and" function for the command and the group.  That's so bad, you'd swear it was a bug.&lt;BR /&gt;&lt;BR /&gt;So now your problem gets into lots of scripting...</description>
      <pubDate>Tue, 02 Aug 2005 13:28:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/kill-all-processes-phn8-in-group-where-user-belongs-to/m-p/4915440#M406836</guid>
      <dc:creator>TwoProc</dc:creator>
      <dc:date>2005-08-02T13:28:59Z</dc:date>
    </item>
    <item>
      <title>Re: Kill all processes PHN8 in group where user belongs to</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/kill-all-processes-phn8-in-group-where-user-belongs-to/m-p/4915441#M406837</link>
      <description>From ps man page&lt;BR /&gt;&lt;BR /&gt;If more than one of the -C, -g, -G, -p, -R, -t, -u, -Z, and -U options&lt;BR /&gt;      are specified, processes will be selected if they match any of the&lt;BR /&gt;      options specified.&lt;BR /&gt;&lt;BR /&gt;Why don't you try something like&lt;BR /&gt;&lt;BR /&gt;$ UNIX95= ps -o user,group,pid,args -C PHN8 | awk '$2 == "china" {print $0}'</description>
      <pubDate>Wed, 03 Aug 2005 23:25:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/kill-all-processes-phn8-in-group-where-user-belongs-to/m-p/4915441#M406837</guid>
      <dc:creator>Ermin Borovac</dc:creator>
      <dc:date>2005-08-03T23:25:32Z</dc:date>
    </item>
    <item>
      <title>Re: Kill all processes PHN8 in group where user belongs to</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/kill-all-processes-phn8-in-group-where-user-belongs-to/m-p/4915442#M406838</link>
      <description>&lt;BR /&gt;Thanks-Ermin&lt;BR /&gt;that is what i am looking for&lt;BR /&gt;it works very well&lt;BR /&gt;$ UNIX95= ps -o user,group,pid,args -C PHN8 | awk '$2 == "china" {print $0}'&lt;BR /&gt;&lt;BR /&gt;One more question would like to ask:&lt;BR /&gt;if i want to replace group "china" with a variable as the line below. This line gives me the group name, when plug in together.&lt;BR /&gt;something is not correct. &lt;BR /&gt;id |cut -f2 -d" "|cut -f2 -d"("|cut -f1 -d")"&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;ID=/usr/bin/id&lt;BR /&gt;CUT=/usr/bin/cut&lt;BR /&gt;GPNAME=`$ID |$CUT -f2 -d" "|$CUT  -f2 -d"("|$CUT -f1 -d")"`&lt;BR /&gt;UNIX95= ps -o user,group,pid,args -C PH8SRVN |awk '$2=="$GPNAME" {print $0}'&lt;BR /&gt;&lt;BR /&gt;the $GPNAME of the last line did not pickup the variable return from the line above.&lt;BR /&gt;Can anyone please help?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Thank you very much,&lt;BR /&gt;Tom</description>
      <pubDate>Thu, 04 Aug 2005 02:32:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/kill-all-processes-phn8-in-group-where-user-belongs-to/m-p/4915442#M406838</guid>
      <dc:creator>tom quach_1</dc:creator>
      <dc:date>2005-08-04T02:32:41Z</dc:date>
    </item>
    <item>
      <title>Re: Kill all processes PHN8 in group where user belongs to</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/kill-all-processes-phn8-in-group-where-user-belongs-to/m-p/4915443#M406839</link>
      <description>Your script can be traced with the -x option. Either run the script like this:&lt;BR /&gt; &lt;BR /&gt;sh -x myscript&lt;BR /&gt; &lt;BR /&gt;Or insert set -x as the second line in the script. However, your script can be simplified quite a bit:&lt;BR /&gt; &lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;export PATH=/usr/bin&lt;BR /&gt;&lt;BR /&gt;GPNAME=$(id|awk '{print $2}'|tr -s "(" " "|cut -f2 -d=|awk '{print $1}')&lt;BR /&gt;&lt;BR /&gt;UNIX95= ps -o user,group,pid,args -C PH8SRVN  -G $GPNAME&lt;BR /&gt; &lt;BR /&gt;The `cmds` construct is considered deprecated (see man sh-posix or man ksh) in favor of $(cmds). There are several other techniques to extract the group information from id. In this example, the group number is extracted rather than the name. For ps, the -G option accepts a GID number or symbolic name. And since ps can search for the GID, an additional string compare by awk isn't necessary.</description>
      <pubDate>Thu, 04 Aug 2005 05:10:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/kill-all-processes-phn8-in-group-where-user-belongs-to/m-p/4915443#M406839</guid>
      <dc:creator>Bill Hassell</dc:creator>
      <dc:date>2005-08-04T05:10:44Z</dc:date>
    </item>
    <item>
      <title>Re: Kill all processes PHN8 in group where user belongs to</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/kill-all-processes-phn8-in-group-where-user-belongs-to/m-p/4915444#M406840</link>
      <description>Here's one way to introduce shell variables into awk statements.&lt;BR /&gt;&lt;BR /&gt;Change this&lt;BR /&gt;&lt;BR /&gt;UNIX95= ps -o user,group,pid,args -C PH8SRVN |awk '$2=="$GPNAME" {print $0}'&lt;BR /&gt;&lt;BR /&gt;to&lt;BR /&gt;&lt;BR /&gt;UNIX95= ps -o user,group,pid,args -C PH8SRVN |awk -v GROUP=$GPNAME '$2==GROUP {print $0}'</description>
      <pubDate>Thu, 04 Aug 2005 19:32:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/kill-all-processes-phn8-in-group-where-user-belongs-to/m-p/4915444#M406840</guid>
      <dc:creator>Ermin Borovac</dc:creator>
      <dc:date>2005-08-04T19:32:36Z</dc:date>
    </item>
    <item>
      <title>Re: Kill all processes PHN8 in group where user belongs to</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/kill-all-processes-phn8-in-group-where-user-belongs-to/m-p/4915445#M406841</link>
      <description>Thank you very much Bill &amp;amp; Ermin&lt;BR /&gt;It works great&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Tom</description>
      <pubDate>Fri, 05 Aug 2005 06:57:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/kill-all-processes-phn8-in-group-where-user-belongs-to/m-p/4915445#M406841</guid>
      <dc:creator>tom quach_1</dc:creator>
      <dc:date>2005-08-05T06:57:57Z</dc:date>
    </item>
    <item>
      <title>Re: Kill all processes PHN8 in group where user belongs to</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/kill-all-processes-phn8-in-group-where-user-belongs-to/m-p/4915446#M406842</link>
      <description>Thank you!&lt;BR /&gt;Regards,&lt;BR /&gt;Tom</description>
      <pubDate>Fri, 05 Aug 2005 06:59:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/kill-all-processes-phn8-in-group-where-user-belongs-to/m-p/4915446#M406842</guid>
      <dc:creator>tom quach_1</dc:creator>
      <dc:date>2005-08-05T06:59:10Z</dc:date>
    </item>
  </channel>
</rss>

