[Summary] script that gets PID

From: Oyanarte Portilho <portilho_at_fis.unb.br>
Date: Mon, 12 Mar 2001 19:00:04 -0300 (EST)

Hi Gurus,

Many thanks to Mandell Degerness, Patrick Farley, alan_at_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?
Received on Mon Mar 12 2001 - 22:02:11 NZDT

This archive was generated by hypermail 2.4.0 : Wed Nov 08 2023 - 11:53:41 NZDT