Topic
  • 4 replies
  • Latest Post - ‏2012-05-04T13:25:41Z by orphy
shibhikkiran
shibhikkiran
17 Posts

Pinned topic How do kill all the processes which are intiated by a particular user?

‏2012-05-03T09:15:51Z |
Hello,

Suppose, If an user initiated a process which consumes lot of real memory and it effetcs other important processes running on the system.

So, I want to kill the processes which are initiated by an user, then
How could I do this?

Expecting your response!

Regards,
Kiran
Updated on 2012-05-04T13:25:41Z at 2012-05-04T13:25:41Z by orphy
  • SystemAdmin
    SystemAdmin
    6902 Posts

    Re: How do kill all the processes which are intiated by a particular user?

    ‏2012-05-03T09:46:19Z  
    Hi Kiran,

    You may use topas command,

    
    Topas Monitor 
    
    for host:    AIXMODEL             EVENTS/QUEUES    FILE/TTY Thu May  3 17:44:49 2012   Interval:  2         Cswitch     214  Readch     1064 Syscall     100  Writech     413 CPU  User%  Kern%  Wait%  Idle%  Physc   Entc   Reads         2  Rawin         0 ALL    0.3    7.3    0.0   92.3   0.01   14.2   Writes        2  Ttyout      185 Forks         0  Igets         0 Network  KBPS   I-Pack  O-Pack   KB-In  KB-Out  Execs         0  Namei         1 Total     3.1     36.0     1.0     2.9     0.3  Runqueue    1.0  Dirblk        0 Waitqueue   0.0 Disk    Busy%     KBPS     TPS KB-Read KB-Writ                   MEMORY Total     0.0      0.0     0.0     0.0     0.0  PAGING           Real,MB    2048 Faults        0  % Comp     48 FileSystem        KBPS     TPS KB-Read KB-Writ  Steals        0  % Noncomp  46 Total              1.0     1.5    1.0    0.0    PgspIn        0  % Client   46 PgspOut       0 Name            PID  CPU%  PgSp Owner           PageIn        0  PAGING SPACE topas       7340100   0.0   1.5 root            PageOut       0  Size,MB    2048 sshd        9699334   0.0   1.1 root            Sios          0  % Used      1 nfssync_    2490472   0.0   0.7 root                             % Free     99 vmmd         458770   0.0   1.2 root            NFS (calls/sec) getty 5374140   0.0   0.6 root            SerV2         0  WPAR Activ    0 nfsd        5767376   0.0   1.8 root            CliV2         0  WPAR Total    0 xmgc         851998   0.0   0.4 root            SerV3         0  Press: 
    "h"-help java        6357218   0.0  33.2 root            CliV3         0         
    "q"-qui
    


    For example above, topas is your top process, which owns by root,
    You may kill that process already.

    
    root@AIXMODEL:/ # ps -ef|grep 7340100 root 7012426 6684842   0 17:46:18  pts/1  0:00 grep 7340100 root 7340100 8650848   0 17:44:39  pts/0  0:00 topas
    


    Hope this helps

    Reagards
  • SystemAdmin
    SystemAdmin
    6902 Posts

    Re: How do kill all the processes which are intiated by a particular user?

    ‏2012-05-03T09:53:21Z  
    Hi,

    use this command to know particular in Memory

    
    root@AIXMODEL:/ # svmon -P -O summary=basic,unit=MB Unit: MB   ------------------------------------------------------------------------------- Pid Command          Inuse      Pin     Pgsp  Virtual 6750428 java            142.89     33.4        0   119.32 6357218 java            113.52     33.3        0   104.84 3145972 cimserver         96.8     33.3        0     96.8 2949250 rmcd              78.7     33.2        0     77.9 5111986 cimlistener       78.1     33.2        0     78.1 3604604 tier1slp          76.2     33.2        0     76.2 4259996 slp_srvreg        75.9     33.2        0     75.8 5243056 rpc.mountd        74.3     33.2        0     74.2 4718766 rpc.statd         74.3     33.2        0     74.2 6553808 topasrec          73.8     33.2        0     72.3 7930108 IBM.CSMAgentR     73.7     33.3        0     73.4 5832888 sendmail          73.5     33.2        0     72.4 4194490 IBM.DRMd          73.3     33.3        0     73.2 7340124 topas             73.3     33.2        0     72.9 7667952 IBM.ServiceRM     73.2     33.3        0     73.0 9699346 sshd              73.0     33.2        0     72.4 7012456 sshd              73.0     33.2        0     72.4 3473632 sshd              72.6     33.2        0     72.0 3997866 cron              72.6     33.2        0     71.8 2293960 portmap           72.3     33.2        0     72.3 3932284 snmpdv3ne         72.3     33.2        0     72.1 3014768 srcmstr           72.2     33.2        0     72.2 2097260 syncd             72.2     33.3        0     72.2 6488142 ksh               72.2     33.2        0     71.9 6684868 ksh               72.2     33.2        0     71.9 6226132 ksh               72.1     33.2        0     71.9 6422732 ksh               72.1     33.2        0     71.9 1 init              72.1     33.2        0     72.0 3211428 xntpd             72.1     33.2        0     71.8 5374140 getty             71.9     33.2        0     71.9 5701816 nimsh             71.9     33.2        0     71.9 3801228 inetd             71.7     33.2        0     71.6 6095054 rpc.lockd         71.7     33.2        0     71.6 2818206 writesrv          71.6     33.2        0     71.6 5963988 qdaemon           71.6     33.2        0     71.6 3276930 cimssys           71.6     33.2        0     71.6 3342456 cimssys           71.6     33.2        0     71.6 5308592 CIM_diagd         71.6     33.2        0     71.6 4063320 nfsd              71.5     33.2        0     71.5 5177508 biod              71.5     33.2        0     71.5 3670200 uprintfd          71.4     33.2        0     71.4 1638476 shlap64           55.2     33.4        0     55.1 4849742 svmon             54.0     33.4        0     53.7 5636278 aixmibd           53.9     33.4        0     53.4 2162848 errdemon          53.7     33.4        0     53.2 5439660 snmpmibd          53.4     33.4        0     53.2 5046504 hostmibd          53.4     33.4        0     53.2 4915376 syslogd           53.0     33.4        0     52.9 1900606 j2pg              38.6     35.2        0     38.6 5767376 nfsd              38.3     33.5        0     38.3 2424984 rpc.lockd         37.6     33.5        0     37.6 458770 vmmd              37.6     33.5        0     37.6 1179688 gil               37.3     33.5        0     37.3 2228296 dog               37.3     33.7        0     37.3 2490472 nfssync_kproc     37.1     33.4        0     37.1 262156 lrud              37.0     33.6        0     37.0 393232 psmd              37.0     33.6        0     37.0 786460 pilegc            37.0     33.4        0     37.0 1245226 wlmsched          36.9     33.4        0     36.9 1507400 ldmp_process      36.9     33.4        0     36.9 2687062 nfsSM             36.9     33.4        0     36.9 1704160 kbiod             36.9     33.4        0     36.9 2031694 aioLpool          36.8     33.4 0     36.8 1048612 wait              36.8     33.6        0     36.8 1114150 netm              36.8     33.4        0     36.8 131076 wait              36.8     33.6        0     36.8 196614 sched             36.8     33.4        0     36.8 264 swapper           36.8     33.4        0     36.8 1310764 armtrace_kpro     36.8     33.4        0     36.8 65802 sched             36.8     33.4        0     36.8 327694 vmptacrt          36.8     33.4        0     36.8 2359440 rtcmd             36.8     33.4        0     36.8 1441830 n4bg              36.8     33.4        0     36.8 524308 memgrdd           36.8     33.4        0     36.8 2556018 rgsr              36.8     33.4        0     36.8 1572922 lvmbb             36.8     33.4        0     36.8 589846 lsareapr          36.8     33.4        0     36.8 655420 memp_rbd          36.8     33.4        0     36.8 2752600 rdpgc             36.8     33.4        0     36.8 720922 devstatd          36.8     33.4        0     36.8 3735724 random            36.8     33.4        0     36.8 1769588 usbCfgDev         36.8     33.4        0     36.8 851998 xmgc              36.8     33.4        0     36.8 917536 wait              36.8     33.6        0     36.8 983074 wait              36.8     33.6        0     36.8 1966192 aioPpool          36.8     33.4        0     36.8 0 swapper           36.8     33.5        0     36.8
    
  • EmersonRibeiro
    EmersonRibeiro
    1 Post

    Re: How do kill all the processes which are intiated by a particular user?

    ‏2012-05-03T20:58:09Z  
    I'd do something like

    
    ps -ef | grep <USER> | awk 
    '{print "kill -9 "$2}' | sh -x
    


    Of course that'll kill every process started by this user.
  • orphy
    orphy
    480 Posts

    Re: How do kill all the processes which are intiated by a particular user?

    ‏2012-05-04T13:25:41Z  
    If you want to kill ALL processes owned by a particular user, say apache, then this will work but it will not kill any ksh so you will need to kill those with a kill -9 but it's best to tell the user(s) to get out themselves rather than doing the -9.

    1. ps -fuapache|grep -v PID|awk '{print $2}'|xargs -t -i kill {}

    If you just want to kill a subset of processes owned by a user, use grep to narrow things down. e.g.

    1. ps -fuapache|grep -v PID|egrep '<put a unique search string here>'|awk ...
    Orphy