Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This is on an Amazon Linux instance (apparently based on CentOS 6)

# service httpd restart
Stopping httpd:                                            [FAILED]
Starting httpd: (98)Address already in use: make_sock: could not bind to address [::]:8080
(98)Address already in use: make_sock: could not bind to address
no listening sockets available, shutting down
Unable to open logs

Obviously it won't start since the stop failed. But, why wouldn't it stop in the first place? I can type "service httpd stop" over and over again and it just keeps printing [FAILED]. "killall httpd" works fine.

After doing a kill and a service httpd start, stop works normally again for a while. Most disconcerting.

Server version: Apache/2.2.24 (Unix)
Server built:   May 20 2013 21:12:45
share|improve this question
It's related to restarting via an rpm %post script. Still don't know why exactly, but I've written a script that does a very detailed shutdown/restart. Hopefully I've accounted for all the edge cases. – jsd Jun 20 '13 at 18:48

Are you doing anything to cleanup/delete the service lockfile? It's probably stored at /var/run/ If that gets removed, the CentOS service infrastructure doesn't know that Apache is running, or what process ID it's using. So it fails to stop it.

share|improve this answer
Not me. I do have some rpms that would try to restart apache, I wonder if they are trying to do it at the same time and that's somehow messing things up. I figured they'd go one after the other but maybe it's trying to run them in parallel. – jsd Jun 19 '13 at 19:04
Alternately, if it's restarting Apache without using service apache restart, that might result in changing the PID values. (eg: by using kill or apachectl directly) – Christopher Karel Jun 19 '13 at 21:06
apachectl manages the pid file correctly. – jsd Jun 19 '13 at 22:55
Yup, you're right. (I clearly never use that) – Christopher Karel Jun 20 '13 at 14:53

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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