LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 04-28-2006, 12:26 PM   #1
tradnbillies
LQ Newbie
 
Registered: Feb 2004
Posts: 23

Rep: Reputation: 15
script to kill processes


I am trying to write a shell script that will kill multiple-process processes or all processes with the same owner. The script should not allow anyone to attempt to kill all or any processes by owner if that owner is root.

Any thoughts?
 
Old 04-28-2006, 02:36 PM   #2
uselpa
Senior Member
 
Registered: Oct 2004
Location: Luxemburg
Distribution: Slackware, OS X
Posts: 1,507

Rep: Reputation: 47
ps, xargs and kill should do.
 
Old 04-28-2006, 03:00 PM   #3
uselpa
Senior Member
 
Registered: Oct 2004
Location: Luxemburg
Distribution: Slackware, OS X
Posts: 1,507

Rep: Reputation: 47
As a one-liner:

Code:
ps -u $1 -o pid | xargs kill -9
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
shell script to kill processes running on port number varunbihani Linux - Newbie 13 12-06-2005 08:46 AM
how to use kill to kill a batch of processes with same name? dr_zayus69 Linux - Software 2 09-03-2005 06:35 PM
script/command to kill processes running on particular port varunbihani Linux - General 2 07-08-2005 03:35 AM
shell script to kill all processes on specified port varunbihani Linux - General 1 04-19-2005 05:39 AM
HP-UX failing to kill some processes itumeleng Other *NIX 1 01-21-2005 08:14 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:34 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration