Thursday, January 29, 2009

slow apache2 restart

On ubuntu/debian, restarting apache2 is rather slow, which may be annoying if you are developping and restarting it frequently. I measured it and it is exactly 10 seconds.

$ date;sudo /etc/init.d/apache2 restart;date
Thu Jan 29 11:44:30 CET 2009
* Restarting web server
apache2 [ OK ]
Thu Jan 29 11:44:41 CET 2009


After looking at /etc/init.d/apache2 script, i localize an evil "sleep 10" :) removing it made the restart intantaneous.
 restart | force-reload)
log_begin_msg "Forcing reload of web server (apache2)..."
if ! apache_stop; then
log_end_msg 1
fi
# <<<<< the following line has been commented
# sleep 10
if $APACHE2CTL start; then
log_end_msg 0
else
log_end_msg 1
fi
;;

0 comments:

Share/Save/Bookmark