diff -Naur apache2-2.2.22.orig/debian/apache2.2-common.apache2.init apache2-2.2.22/debian/apache2.2-common.apache2.init --- apache2-2.2.22.orig/debian/apache2.2-common.apache2.init 2016-07-12 14:44:10.905072398 +0200 +++ apache2-2.2.22/debian/apache2.2-common.apache2.init 2016-07-12 14:51:04.289285419 +0200 @@ -169,6 +169,19 @@ fi } +apache_wait_for_pidfile() { + # wait up to 5 seconds until really started (i.e., PIDFILE exists) + i=0 + while [ "$i" -lt "50" ]; do + if [ -e "$PIDFILE" ]; then + return 0 + fi + i=$(($i+1)) + sleep 0.1 + done + return 1 +} + close_fds () { local fd for fd in /proc/self/fd/* @@ -195,7 +208,12 @@ log_progress_msg htcacheclean start_htcacheclean || log_end_msg 1 fi - log_end_msg 0 + if ! apache_wait_for_pidfile ; then + log_end_msg 0 + log_warning_msg "apache2 is running, but pidfile is not yet created" + else + log_end_msg 0 + fi else log_end_msg 1 fi @@ -286,7 +304,12 @@ if check_htcacheclean ; then start_htcacheclean || log_end_msg 1 fi - log_end_msg 0 + if ! apache_wait_for_pidfile ; then + log_end_msg 0 + log_warning_msg "apache2 is running, but pidfile is not yet created" + else + log_end_msg 0 + fi else log_end_msg 1 fi