LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[ILUG] kill process by name

[ILUG] kill process by name

Colm MacCárthaigh colmmacc at redbrick.dcu.ie
Tue Jul 16 13:26:10 IST 2002


On Tue, Jul 16, 2002 at 01:16:20PM +0100, Donncha O Caoimh wrote:
> I renice my setiathome processes when I'm AFK . I setup the renice command as 
> follows:
> ps auxw|grep setiathome| awk '{ if ($11  == "setiathome") print $2 }' | xargs 
> echo renice 20

with pgrep that would be:

	pgrep setiathome | xargs echo renice 20

personally, I use;

 	renice 20 `pgrep setiathome`

but that's me :)

pgrep has two features which make this safe:

	"The  pattern  is  normally  only  matched against the process name.
         When -f is set, the full command line is used."

and

	"The running pgrep or pkill process will never report itself as
         a match"
 
These problems are common :)

> Now, if someone could show me how to stuff the renice command into the command 
> line history/buffer from a shell script I wouldn't have to copy/paste it 
> afterwards.

in bash; you can use history -s to get thigns into a history, but since that's
a different shell, it won't work. You could source it instead. Why are
you doing this though ?

-- 
colmmacc at redbrick.dcu.ie        PubKey: colmmacc+pgp at redbrick.dcu.ie  
Web:                                 http://devnull.redbrick.dcu.ie/ 




More information about the ILUG mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


Maintained by the ILUG website team. The aim of Linux.ie is to support and help commercial and private users of Linux in Ireland. You can display ILUG news in your own webpages, read backend information to find out how. Networking services kindly provided by HEAnet, server kindly donated by Dell. Linux is a trademark of Linus Torvalds, used with permission. No penguins were harmed in the production or maintenance of this highly praised website. Looking for the Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!
RSS Version
Powered by Dell