Bug#631230: apache2 startup fails with missing log directory
Package: apache2.2-common
Version: 2.2.19-1ubuntu1
Severity: wishlist
Tags: patch
f $APACHE_LOG_DIR (as defined in /etc/apache2/envvars) does not exist, server startup fails.
This would happen, for instance, if /var/log is on a ramdisk. That is something commonly done for systems that use an SSD drive. Putting logs on a ramdisk avoids wearing out the SSD flash memory.
It would be helpful if the apache initscript createad its log subdirectory if needed.
Thanks
--- a/debian/apache2.2-common.apache2.init 2011-05-22 10:21:21 +0000
+++ b/debian/apache2.2-common.apache2.init 2011-06-21 19:28:29 +0000
@@ -172,6 +172,17 @@
case $1 in
start)
log_daemon_msg "Starting web server" "apache2"
+ (
+ # uses subshell to keep current env clear
+ . $APACHE_ENVVARS
+ if [ -d "$APACHE_LOG_DIR" ] ; then
+ return 0
+ elif mkdir "$APACHE_LOG_DIR" ; then
+ return 0
+ else
+ return 1
+ fi
+ ) || log_end_msg 1
if $APACHE2CTL start; then
if check_htcacheclean ; then
log_progress_msg htcacheclean
Reply to: