-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?

3
  • 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 Jun 11, 2015 at 12:10
  • Exactly my question. When i have already erased the httpd package, how am I getting httpd (pid 22595) already running . Jun 11, 2015 at 12:17
  • 3
    You also grep for httpd# including the #. Remove the # to actually properly match for httpd.
    – faker
    Jun 11, 2015 at 12:38

3 Answers 3

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

9
  • Unserstood. But still if I try systemctl status httpd , I get the same error as httpd (pid 22595) already running and Failed to start The Apache HTTP Server. Jun 11, 2015 at 12:15
  • Try this instead service httpd status
    – Machavity
    Jun 11, 2015 at 12:17
  • 3
    My best guess then is that the httpd.pid file still exists and the system is returning that. Since your grep is empty you might want to make sure that file was deleted
    – Machavity
    Jun 11, 2015 at 12:22
  • 1
    Beyond rebooting I don't have any other suggestions
    – Machavity
    Jun 11, 2015 at 12:39
  • 1
    hmmm, tried everything, but ultimately had to reboot. now its working fine Jun 11, 2015 at 12:59
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.

0

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

1
  • 1
    Tried that but didn't work. @Machavity 's suggestion of restart worked. Jun 12, 2015 at 7:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .