apache stopped working -- possible solution

hello -

once or twice a month, apache will freeze up. previously i merely have had to do a:

systemctl restart httpd.service ;​

and that would fix it. so i decided to put that command into crontab and run it daily. this has not fixed the problem, unfortunately. this morning i was seeing the following:

tail /var/log/httpd/error_log;
[Mon Sep 05 09:45:03.601890 2016] [core:emerg] [pid 2877] (28)No space left on device: AH00023: Couldn't create the ssl-cache mutex AH00016: Configuration Failed​

this seems to have fixed it, for now (from this link):

systemctl stop httpd.service ;
for i in `ipcs --semaphores | grep apache | awk '{print $2}'` ;
do
ipcrm --semaphore-id $i;​
done ;
systemctl start httpd.service ;​

i am wondering now if something like this should be in crontab to run every midnight.

references:
ipcs
ipcrm
 
Last edited:

Quags

Administrator
Staff member
Many years ago I wrote this for cpanel/da servers

<pre>
#!/bin/bash

if [ -e /usr/local/apache/bin/httpd ]; then
user=nobody
elif [ -e /usr/local/cpanel ]; then
user=nobody
elif [ /usr/sbin/httpd ]; then
user=apache
else
exit;
fi

for i in $(ipcs | grep ^0 | grep $user | awk '{print $2 }'); do ipcrm sem $i; done
</pre>

I run it only if apache is down before trying to restart it. Never when it is up and running.
 
Top