tailwatchd is no longer restarting apache when needed


Well-Known Member
Mar 13, 2004
I've noticed this more and more lately:

1 -- Apache goes down under a very low load, who knows why, and stays down. tailwatchd does not do it's job to bring Apache back up.

2 -- When running this at shell:
service httpd status

... the command only stalls and produces no result. Still the load is very low and Apache is dead.

3 -- he following command only shows one process ID (perhaps a zombie process because again, Apache is dead):
/usr/bin/pgrep httpd

4 -- Our third party monitoring goes off, or a customer calls to complain, then I go to shell and do this:
/etc/rc.d/init.d/httpd startssl

...then everything starts up again.

I've tried using the following script (croned to run every minute) that checks for Apache processes then restarts if there is none, but due to that one lame process (I guess), the script does not work very well:

# Apache Process Monitor
# Restart Apache Web Server When It Goes Down
# -------------------------------------------------------------------------
# Copyright (c) 2003 nixCraft project <http://cyberciti.biz/fb/>
# This script is licensed under GNU GPL version 2.0 or above
# -------------------------------------------------------------------------
# This script is part of nixCraft shell script collection (NSSC)
# Visit Bash Shell Scripting Directory For Linux / UNIX for more information.
# -------------------------------------------------------------------------
# RHEL / CentOS / Fedora Linux restart command
RESTART="/sbin/service httpd restart"

# uncomment if you are using Debian / Ubuntu Linux
#RESTART="/etc/init.d/apache2 restart"

#path to pgrep command
PGREP="/usr/bin/pgrep -l -x"

# Httpd daemon name,
# Under RHEL/CentOS/Fedora it is httpd
# Under Debian 4.x it is apache2

# find httpd pid

if [ $? -ne 0 ] # if apache not running
# restart apache

Anyone? Any ideas?

Thanks much!


Staff member
Apr 11, 2011
Hello :)

I recommend determining the reason why Apache is failing, rather than setting up a cron job to restart it. Do you notice any specific error messages in /usr/local/apache/logs/error_log before the process hangs? Also, when is the last time you updated Apache via EasyApache? Do you have any third-party applications associated with Apache (i.e. Nginx) installed?

Thank you.