Web Hosting Talk







View Full Version : How to restart httpd every 10 minutes?


Kicker L7
11-08-2002, 11:19 AM
Hello,

I would like to know how can I restart the apache every 10 minutes. and what is the best way to do it.

I have used this method :

I have opened /etc/cron.d/sysstat

and added the fallowing lines:

#Restart httpd every 10 minutes
*/10 * * * * root /etc/rc.d/init.d/httpd restart


Is this going to work? any I deas?

Thanks for help.

MarkIL
11-08-2002, 11:46 AM
That line seems to be okay. May I ask why you need to restart httpd every 10 minutes?

Kicker L7
11-08-2002, 12:05 PM
Hey lewney thanx for the reply.

I have transfered like 30 accounts from another server to my server. Now everything is working okay, but every few hours, apache goes down and WHM doesn't know about it, its showing a green light.

So everytime I have to restart the httpd from WHM to get the hosted websites back online.

Any Ideas how to fix this?

Andrew
11-08-2002, 12:09 PM
Upgrade checksrvd :)

Also check your logs to find out what's causing Apache to fail. :)

goodness0001
11-08-2002, 12:46 PM
Insert this into a cron, and execute it every 10 minutes. If apache fails then it automatically restarts, if apache is running, then nothing happens.

ps auwx | grep -v grep | grep httpd || /path/to/httpd restart

dbbrock1
11-08-2002, 04:46 PM
"apache goes down and WHM doesn't know about it, its showing a green light."

If apache went down, why would WHM even work?

forumservers
11-08-2002, 05:11 PM
The question is, why do you need to restart it every 10 minutes in the first place.

Andrew
11-08-2002, 05:18 PM
Originally posted by dbbrock1
"apache goes down and WHM doesn't know about it, its showing a green light."

If apache went down, why would WHM even work?

I believe because it runs as a separate server.

Kicker L7
11-08-2002, 06:06 PM
Thanx for the replies.

Im still having this problem with apache.. it fails every hour and I have to restart it again. otherwise none of the hosted websites will show up.

-- Im using IP for WHM so it doesn't matter if apache is down.
-- I need to restart the apache every 10 min so the hosted websites show up.

Here is my Error_Log :

---------------------
[Fri Nov 8 16:41:02 2002] [notice] SIGUSR1 received. Doing graceful restart
[Fri Nov 8 16:41:03 2002] [error] Cannot resolve host name IN --- ignoring!
[Fri Nov 8 16:41:03 2002] [warn] NameVirtualHost 139.81.52.xxx:80 has no VirtualHosts
[Fri Nov 8 16:41:03 2002] [warn] NameVirtualHost 139.81.52.xxx:80 has no VirtualHosts
[Fri Nov 8 16:41:03 2002] [warn] NameVirtualHost 139.81.52.xxx:80 has no VirtualHosts
[Fri Nov 8 16:41:03 2002] [warn] NameVirtualHost 139.81.52.xxx:80 has no VirtualHosts
[Fri Nov 8 16:41:03 2002] [warn] NameVirtualHost 139.81.52.xxx:80 has no VirtualHosts
[Fri Nov 8 16:41:04 2002] [notice] Apache/1.3.26 (Unix) mod_jk/1.2.0 mod_log_bytes/0.3 mod_bwlimited/1.0 PHP/4.2.3 FrontPage/5.0.2.2510 mod_ssl/2.8.10 OpenSSL/0.9.6b configured -- resuming normal operations
[Fri Nov 8 16:41:04 2002] [notice] suEXEC mechanism enabled (wrapper: /usr/local/apache/bin/suexec)
[Fri Nov 8 16:41:04 2002] [notice] Accept mutex: sysvsem (Default: sysvsem)
[Fri Nov 8 16:21:16 2002] [notice] child pid 25688 exit signal Segmentation fault (11)
[Fri Nov 8 16:20:31 2002] [notice] child pid 25860 exit signal Segmentation fault (11)
[Fri Nov 8 16:20:34 2002] [notice] child pid 25825 exit signal Segmentation fault (11)
[Fri Nov 8 14:44:59 2002] [warn] [csd] filedescriptor (1179) larger than FD_SETSIZE (1024) found, you probably need to rebuild Apache with a larger FD_SETSIZE

--------------------

If anyone can help me to fix this, I can give $50 reward

My AOL name is: kickerl7er

Thank You.

JTY
11-08-2002, 09:25 PM
Looks like apache is trying to open more files, than it can handle.

You need to increase the value of FD_SETSIZE in the Apache build. You may also need to increase the number in your Kernel.

Kicker L7
11-08-2002, 09:38 PM
Hey JTY,

can you please explain to me how can I do this step by step?

Thank You.

JTY
11-08-2002, 10:50 PM
Are you running a kernel newer than 2.2?

If, so do this...

Login via SSH to root, and do the following.

echo 8192 > /proc/sys/fs/file-max
echo 32768 > /proc/sys/fs/inode-max

Then restart Apache. You'll need to add those commands, to your /etc/rc.d/rc.local to make the setting stay, after system reboot.

Acronym BOY
11-08-2002, 11:39 PM
Originally posted by dbbrock1
"apache goes down and WHM doesn't know about it, its showing a green light."

If apache went down, why would WHM even work?

As answered, and probably for teh same reason Webmin still works when I take apache down for a few minutes.

bombino
11-09-2002, 12:38 PM
Originally posted by Kicker L7
Here is my Error_Log :

---------------------
[Fri Nov 8 16:21:16 2002] [notice] child pid 25688 exit signal Segmentation fault (11)
[Fri Nov 8 16:20:31 2002] [notice] child pid 25860 exit signal Segmentation fault (11)
[Fri Nov 8 16:20:34 2002] [notice] child pid 25825 exit signal Segmentation fault (11)
--------------------


These _could_ be a sign of a faulty module loaded into Apache. Try removing any non-standard modules and seeing if that fixes the problem.

BiaSecurity
11-09-2002, 05:47 PM
you should update to a version of openssl higher then 0.9.6e(pref. 0.9.6g), it would be a very very good idea

i sent you a more details via PM

Maximiliam
11-09-2002, 06:23 PM
Do this if you are running redhat 7+, and after you did it run the apache install from cpanel again. It has all limits upped already.

Edit:

/root/.bashrc

Add:

ulimit -u unlimited
ulimit -S -H -n 4096

Edit:

/etc/security/limits.conf

Add:

* soft nofile 2048
* hard nofile 65535

Edit:

/etc/pam.d/login

Add:

session required /lib/security/pam_limits.so

Edit:

/etc/rc.d/rc.local

Add:

echo 64000 > /proc/sys/fs/file-max
ulimit -u unlimited
ulimit -S -H -n 4096

and restart your computer before you reinstall apache.

Kicker L7
11-10-2002, 07:04 AM
Still have the same problem...nothing changed.

Now few things......

When the websites are down,

If I restart apache from SSH, It wont fix the problem...
If I retsrat apache from WHM, It worx and everything gets back to normal.

Now, I need to put this command in cron, or some place that excute it each 10 minutes.

lynx -auth=root:password http://xxx.xxx.xxx.xxx:2086/scripts/reshttpd


I did this but I got a weird message in my inbox:
*/10 * * * * lynx -auth=root:password http://xxx.xxx.xxx.xxx:2086/scripts/reshttpd


-----------------
Your Terminal type is unknown!

Enter a terminal type: [vt100]
TERMINAL TYPE IS SET TO vt100
(B)0[?7h[?1h=Getting http://xx.xx.xx.xx:2086/scripts/reshttpdLooking up xx.xx.xx.xx:2086xxx.xx.xx.xxx:2086Making HTTP connection to xx.xx.xx.xxx:2086Sending HTTP request.HTTP request sent; waiting for response.

[?1l>

----------------

If I type this command directly in SSH, It worx, but in cron, I get the above message.

Any help would be appreciated.