On Sat, Nov 24, 2001 at 04:29:06PM -0500, Kevin J. Menard, Jr. wrote: > Hey guys, > > And I was thinking just have a separate vhost.conf file and modifying > that, then restarting apache with graceful.
This is exactly what I do, with the same filename vhost.conf and everything =) In fact, apache's httpd.conf is configured to read vhost.conf, but any of my web-based admin tools (which I wrote) use a file called vhost.latest, then this script runs as a cron job every 3 minutes: #!/bin/bash diff /etc/apache/vhost.conf /etc/apache/vhost.latest >/dev/null if [ $? = 1 ] ; then echo >/tmp/thisisnow `date +%Y%m%d-%H%M%S` cat /etc/apache/vhost.conf > /etc/apache/vhost.conf.`cat /tmp/thisisnow` cat /etc/apache/vhost.latest >/etc/apache/vhost.conf echo >>/var/log/telcust.log `date +%Y-%m-%d-%H-%M-%S` INFO: Rotated vhost.conf echo Rotating apache configuration! echo apachectl configtest if [ $? = 0 ] ; then apachectl stop sleep 1 apachectl start sleep 2 apachectl start pidof /usr/sbin/apache >/dev/null if [ $? = 1 ] ; then echo >>/var/log/telcust.log `date +%Y-%m-%d-%H-%M-%S` WARN: Apache did not restart echo DID NOT DETECT ANY RUNNING APACHE PROCESSES!!! echo echo End of /var/log/apache/error.log follows echo tail /var/log/apache/error.log cat /etc/apache/vhost.conf.`cat /tmp/thisisnow` >/etc/apache/vhost.conf apachectl start echo echo I have restored the old config file and restarted apache. echo You will get this error every three minutes as an incentive echo to fix the problem in /etc/apache/vhost.latest ! else echo Detected apache processes have restarted OK. fi else echo echo >>/var/log/telcust.log `date +%Y-%m-%d-%H-%M-%S` WARN: Apache conf failed syntax test echo Oh dear, the new apache config failed the configtest. echo Will restore the old config and not restart apache. cat /etc/apache/vhost.conf.`cat /tmp/thisisnow` >/etc/apache/vhost.conf fi fi ------------------------------------------------- The vhost.latest simply contains lots of <VirtualHost> blocks. Cheers, gdh