This is my first indication of an issue:
$ sudo /sbin/service httpd restart
Stopping httpd: [FAILED]
Starting httpd: no listening sockets available, shutting down
Unable to open logs
[FAILED]
I know httpd is running
$ ps -ef | grep httpd | grep -v grep
apache 9619 20181 0 07:08 ? 00:00:03 /usr/sbin/httpd
apache 10092 20181 0 Jan24 ? 00:00:07 /usr/sbin/httpd
apache 13086 20181 0 06:09 ? 00:00:00 /usr/sbin/httpd
apache 13717 20181 0 Jan25 ? 00:00:01 /usr/sbin/httpd
apache 14730 20181 0 07:13 ? 00:00:01 /usr/sbin/httpd
apache 16359 20181 0 09:54 ? 00:00:00 /usr/sbin/httpd
root 20181 1 0 2011 ? 00:00:01 /usr/sbin/httpd
apache 21450 20181 0 09:55 ? 00:00:00 /usr/sbin/httpd
and it is using ports 80 and 443
$ sudo netstat -lnp | grep :80
tcp 0 0 :::80 :::* LISTEN 9619/httpd
$ sudo netstat -lnp | grep :443
tcp 0 0 :::443 :::* LISTEN 9619/httpd
so I assume that I get the message “no listening sockets available” because httpd cannot stop to release ports 80 and 443.
I am using RHEL version 5.7:
$ cat /etc/redhat-release
Red Hat Enterprise Linux Server release 5.7 (Tikanga)
I can see a bunch of processes running for httpd:
$ pgrep httpd
9619
10092
13086
13717
14730
16359
20181
21450
What could prevent httpd from stopping?
If I kill the processes for httpd, will I be able to start httpd without a problem?
The stop function in /etc/init.d/httpd uses the pidfile:
killproc -p ${pidfile} -d ${STOP_TIMEOUT} $httpd
Possibly, the pidfile /var/run/httpd.pid
is out of date or missing (could you have started httpd in the past without using the /etc/init.d
script or service
?). You can check that file (and its contents) with your ps -ef |grep http
.
Meh, just sudo kill 20181
. Then start the service up as you normally would. Then try the restart after that.
If it happens again, you probably should investigate why the pid file is getting out of whack with the process table.
Check more discussion of this question.