0

I have a RHEL7 server (no GUI) running several distinct instances of httpd (distinct PID files, not defined as services...don't ask).

Trying to build a simple script that will tell me which of my httpd instances are actually started. If I run ps -ef | grep httpd, I get a listing that looks pretty much like I want, but I get a hit for every PID, which ends up giving me several hundred results. I'd like something that would give me one line for each instance.

Any ideas ?

0

Use the existing PID files, if you have them:

ps -f $(cat pidfile1 pidfile2 pidfile3 ...)
  • Thanks for the tip ! I'm doing ps -f $(cat /run/httpd/*.pid) and it works perfectly. – Felix Jun 10 '18 at 3:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.