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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Process Id for roll forward 2

Status
Not open for further replies.

JBaileys

Technical User
Jun 23, 2003
244
US

How would you get the process id for a roll forward command?
Only looking for the PID.

ps -r | grep -i ?rollforward?

If I use ps -r pid, it only returns the number but I have no way to know that i came from a roll forward command.

 
Code:
ps -x | awk '/rollforward/ && ! /awk/ {print $1}'
Notes
[ul]
[li]ps -x puts the process id first[/li]
[li]Use awk, rather than grep, because you want to proces the output. Ok, you could use grep and then cut but awk will do both jobs in one[/li]
[li]Notice the !/awk/ condition. This stops the command picking up itself[/li]
[/ul]

Ceci n'est pas une signature
Columb Healy
 
This stops the command picking up itself
Another way:
ps -x | awk '/[r]ollforward/{print $1}'

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top