I have a server running virtual hosts that get changed quite often. Rather than someone actually going to the server and typing in the apache restart command I was thinking of making a cron (every 1, 5 or 10 minutes, maybe only during working hours, when changes to the virtual hosts are actually made) to restart apache gracefully.
sudo apachectl graceful
I found an explanation here on stackoverflow that goes like this:
Graceful does not wait for active connections to die before doing a "full restart". It is the same as doing a HUP against the master process. Apache keeps children (processes) with active connections alive, whilst bringing up new children with new configuration (or nicely cleared caches) for each new connection. As the old connections die off, those child processes are killed as well to make way for the new ones.
Would this mean that there would be little to no impact on the visitor's experience (long wait times), or should I just stick with manually restarting apache?
Thanks!
Sorry, but I don't consider that a good idea.
If you're planning on restarting Apache every X minutes, even though it may not need it, I see plenty of downside there but no upside.
If you're just checking and restarting when needed, such as with a process running which can detect when a change is needed, that might be okay.
Personally, I wouldn't even do that since I'd rather keep control over deployment changes. For example, if you wanted to get a whole lot of stuff installed during the working day ready for restart but not actually activate it till quiet time.
Of course, in a robust environment, you'd be running multiple servers so you could offline them one at a time for changes, without affecting anyone.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With