Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

If apache fails to restart, will it keep running but not shut down the previous instance of it? So if I'm working on the server and I restart apache and it fails, will that keep my site running on it's previous configuration?

share|improve this question
    
Please post the exact error message you are getting. –  Powertieke Jul 9 '10 at 14:37
add comment

4 Answers 4

up vote 0 down vote accepted

If your configuration is broken, even a configuration reload (via a SIGHUP) will cause Apache to exit.

You can use apachectl to do a simple configuration test. Be careful though, as it is a good check for syntax errors it will not catch everything. The full command is:

apachectl configtest

Also, many distributions include a wrapper for configtest in the init script.

share|improve this answer
add comment

If you tell apache to restart, it will shut down completely before attempting to restart, leaving you out in the cold if you have an error in your config syntax.

If you tell apache to restart gracefully, then, in addition to the niceties of it not killing processes underneath your users, apache will first check your configuration files for syntax errors. If it finds any, it will not restart.

I almost always use graceful when I'm making config changes; there are a few options (ServerLimit, for example) that need full restarts, but graceful should be your default command.

share|improve this answer
    
From the exact documentation you reference: If your configuration file has errors in it when you issue a restart then your parent will not restart, it will exit with an error. –  Warner Jul 9 '10 at 19:55
add comment

if you restart the service (because you changed the config file, maintenance, etc.), it actually stops and try to start it again, if it fails so the service itself will be not available.

as Warner says you need to check your config file and test it to make it sure it does not contains errors, so your service will be available again (successful start / restart)

but as long as you don't fix the problem in the config file, no instances will be available (no www service)

share|improve this answer
add comment

One thing to we wary of is that all the log files exist and can be written to. Configtest doesn't catch problems with creating or writing to log files, so that can prevent your server restarting correctly, and graceful restarts don't seem to prevent that.

share|improve this answer
    
What permissions to log files need to have? Wouldn't it just be root who's writing to them... –  Webnet Sep 24 '10 at 15:07
    
Yes, normally root would be writing them. But if the directory you specify for the log files to go into doesn't exist, and root can't create it because it's in a path owned by some other user you're hosed. The safest way is to create an empty log file and then chown it to root. –  Peter Bagnall Oct 16 '10 at 16:26
add comment

Your Answer

 
discard

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.