tru64-unix-managers (formerly alpha-osf-managers) (1994-2012)
 help / color / mirror / Atom feed
From: Oyanarte Portilho <portilho () fis ! unb ! br>
To: tru64-unix-managers
Subject: [Summary] script that gets PID
Date: Mon, 12 Mar 2001 22:00:04 +0000	[thread overview]
Message-ID: <98443449610087.tru64-unix-managers.marc@archive.invalid> (raw)

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?

                 reply	other threads:[~2001-03-12 22:00 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed
read-only archive

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