-2

When I tried to restart my httpd service using systemctl restart httpd

Checking the status, I found that process is dead and another process is running. so I removed it using yum erase httpd

As a precaution, I checked if the process is still running using ps aux | grep httpd# and found it was but this time the PID was different. and after subsequent queries, the PID kept on changing. If I try to kill using any PID, it would say NO Such Process

Check the screenshot:

enter image description here

Hence the question. How do I stop this process so that I can install the service from scratch and configure it?

Anup Sharma
  • 77
  • 1
  • 1
  • 8
  • 3
    This PID isn't http process. This PID is grep proccess. Try "systemctl status httpd" for check httpd status. But if you erase httpd package, you haven't any process of httpd – Andrés Sánchez García Jun 11 '15 at 12:10
  • Exactly my question. When i have already erased the httpd package, how am I getting httpd (pid 22595) already running . – Anup Sharma Jun 11 '15 at 12:17
  • 3
    You also grep for `httpd#` including the `#`. Remove the `#` to actually properly match for httpd. – faker Jun 11 '15 at 12:38

3 Answers3

2

You have to understand that when you grep httpd you'll not just get back any apache processes but the grep process as well. You're seeing your own command reflected back at you.

# ps ax | grep httpd
1818 ? Ss 0:53 /usr/sbin/httpd
38729 ? S 4:38 /usr/sbin/httpd
38730 ? S 4:49 /usr/sbin/httpd
54915 pts/0 S+ 0:00 grep httpd

Machavity
  • 834
  • 10
  • 26
2

Try:

find / -name "httpd.pid"
Then delete the pid file, if it exists.

Also, just in case:

systemctl stop httpd
systemctl disable httpd

Machavity is right too, whenever you grep from the output of ps you're going to see your grep command too. It's something you'll get used to.

red_shift
  • 162
  • 9
0

Another approach is you could do killall httpd as a way to kill all processes named httpd.

sa289
  • 1,308
  • 2
  • 17
  • 42