tru64-unix-managers (formerly alpha-osf-managers) (1994-2012)
 help / color / mirror / Atom feed
* [Summary] script that gets PID
@ 2001-03-12 22:00 Oyanarte Portilho
  0 siblings, 0 replies; only message in thread
From: Oyanarte Portilho @ 2001-03-12 22:00 UTC (permalink / raw)
  To: tru64-unix-managers

Hi Gurus,

Many thanks to Mandell Degerness, Patrick Farley, alan@nabeth and Bill
Melvin. 

1) Mandell sent the following:

   renice +some_value `ps aux | grep <pattern> | grep -v grep | awk '{print $2}'`

which works fine.

2) Patrich sent:

   #!/bin/sh
   ps -eo pid,comm |grep <searchstring> |while read AA
   do
   echo $AA
   renice +some_value -p $AA
   done

   which also works though produces also a sintax error in renice because
   it takes the process name together with the PID.

3) Allan suggests:

   foreach i ( `ps ax | grep program | grep -v grep | awk '{ print $X }'` )
        command to renice by pid
   end


   which I have not tested. Bill suggests me to read the manual of getpid(2),
   which should be useful in a c program.


Regards,

	Oyanarte Portilho
	Institute of Physics
	University of Brasilia, Brazil


========================

original posting:

> I wish to have a script that gets the PID of a running code and
> renices it. Could you help me?

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2001-03-12 22:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-03-12 22:00 [Summary] script that gets PID Oyanarte Portilho

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox