Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with getting just PID for certain process 4

Status
Not open for further replies.

ChrisDunn

Technical User
Nov 20, 2000
19
0
0
US
I am writing a script right now and am wondering if there is a way that I can get a PID for a certain process with out using ps -l (or maybe using ps -l), all I want is the PID so that I can alter the nice number in the script (using renice).


Thanks for your help,

Chris
 
Hi Chris

Can you get the process to write out its PID to a little text file somewhere?

Or..

Can you filter the output of ps -ef or something to cut out everything but the process you want? If you can you could pipe that through awk and pick up the PID that way.
Mike
michael.j.lacey@ntlworld.com
 
In AIX and some unix you can try
[tt]
PIDvar=`ps -e | grep -w "process name" | awk '{print $1}'`
[tt]

and you can use $PIDvar to do what you want with that process... I hope it works...
 
Check out pidof:
Syntax: pidof <program>.
It's not always working that fine! Best solution is ElgisRamons, that's what I suggest to do, too.

regards
chenn
 
Thanx to all of the contributers, yes chenn I am on an AIX box so that should work. I really appreciate all of the help.

Thanks again,

Chris Dunn
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top