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