How to find out and kill all processes for a user? | Unix Linux Forums | AIX

  Go Back    


AIX AIX is IBM's industry-leading UNIX operating system that meets the demands of applications that businesses rely upon in today's marketplace.

How to find out and kill all processes for a user?

AIX


Tags
aix, unix

Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 02-22-2012
atechcorp atechcorp is offline
Registered User
 
Join Date: Feb 2011
Last Activity: 14 November 2012, 10:56 AM EST
Posts: 20
Thanks: 8
Thanked 10 Times in 2 Posts
How to find out and kill all processes for a user?

Hi!

We are using AIX 5.3.

Can anyone please guide me to find out all the running processes for a specific user, say ' admin' and also kill them by force.

Thanks!
atech
Sponsored Links
    #2  
Old 02-23-2012
zxmaus's Avatar
zxmaus zxmaus is offline Forum Advisor  
Event Manager
 
Join Date: May 2008
Last Activity: 7 September 2014, 5:24 AM EDT
Location: in a putty session :)
Posts: 811
Thanks: 19
Thanked 70 Times in 62 Posts
ps -ef | grep username shows you the running processes
su - username and than kill -9 -1 kills them forced and brings you back to root. Obviously not a good idea to do this for root

Regards
zxmaus
Sponsored Links
    #3  
Old 02-23-2012
admin_xor's Avatar
admin_xor admin_xor is offline
Registered User
 
Join Date: Jun 2011
Last Activity: 8 April 2014, 5:55 AM EDT
Posts: 452
Thanks: 13
Thanked 79 Times in 76 Posts

Code:
ps -ef | grep admin | awk '{ print $2 }' | xargs kill -9

or


Code:
kill -9 $( ps -ef | grep admin | awk '{ print $2 }' )

The Following User Says Thank You to admin_xor For This Useful Post:
blacksteel1988 (09-03-2013)
    #4  
Old 02-23-2012
methyl methyl is offline Forum Advisor  
Advisor
 
Join Date: Mar 2008
Last Activity: 18 April 2014, 5:13 AM EDT
Posts: 6,396
Thanks: 287
Thanked 673 Times in 642 Posts
Unless you are trying to shut down a system after a serious hardware problem there is never a reason to issue kill -9 to processes attached to a database.
Use the proper kill signals for your database engine and give the database engine time to respond.

When cleaning idle sessions follow the kill signals defined by your database engine in the correct order and give the database engine time to respond.

Obviously no problem issuing "kill -9" to orphan processes which have no database files open.
Sponsored Links
    #5  
Old 02-25-2012
kapil514 kapil514 is offline
Registered User
 
Join Date: Oct 2010
Last Activity: 1 October 2014, 9:50 AM EDT
Posts: 17
Thanks: 7
Thanked 0 Times in 0 Posts
The below command is also useful ,

# kill -9 `ps -fu admin |awk '{ print $2 }'|grep -v PID`
Sponsored Links
    #6  
Old 02-26-2012
gito's Avatar
gito gito is offline
Registered User
 
Join Date: Nov 2011
Last Activity: 14 November 2013, 12:05 PM EST
Location: Poland, Wroclaw
Posts: 110
Thanks: 0
Thanked 3 Times in 3 Posts
Another version of the same script this one with while loop

Code:
USER=name_of_your_ser
ps -ef |grep $USER|while read n1 n2 n3; do kill -9 $n2; done

Sponsored Links
    #7  
Old 02-26-2012
Corona688 Corona688 is offline Forum Staff  
Mead Rotor
 
Join Date: Aug 2005
Last Activity: 20 October 2014, 6:33 PM EDT
Location: Saskatchewan
Posts: 19,628
Thanks: 815
Thanked 3,334 Times in 3,123 Posts
Quote:
Originally Posted by methyl View Post
Unless you are trying to shut down a system after a serious hardware problem there is never a reason to issue kill -9 to processes attached to a database.
Use the proper kill signals for your database engine and give the database engine time to respond.
Quote:
Originally Posted by kapil514 View Post
kill -9
Quote:
Originally Posted by gito
kill -9
Again in larger text so people notice it:

Quote:
Originally Posted by methyl View Post
Unless you are trying to shut down a system after a serious hardware problem there is never a reason to issue kill -9 to processes attached to a database.
Use the proper kill signals for your database engine and give the database engine time to respond.
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
kill all user processes vascobrito Shell Programming and Scripting 4 09-03-2009 12:02 PM
Kill all processes belonging to one user narayanv Shell Programming and Scripting 4 08-19-2009 02:40 AM
Kill processes hawaiifiver Shell Programming and Scripting 1 05-16-2009 11:47 AM
kill processes pmrajesh21 Solaris 3 10-30-2008 09:08 AM
kill all processes Terrible Shell Programming and Scripting 0 08-21-2006 07:49 PM



All times are GMT -4. The time now is 01:21 AM.