--- apache2-2.2.22/debian/apache2.2-common.apache2.init.orig 2015-03-06 12:13:35.696241610 +0100 +++ apache2-2.2.22/debian/apache2.2-common.apache2.init 2015-03-06 12:58:21.464809689 +0100 @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash ### BEGIN INIT INFO # Provides: apache2 # Required-Start: $local_fs $remote_fs $network $syslog $named @@ -169,6 +169,18 @@ fi } +close_fds () { + local fd + for fd in /proc/self/fd/* + do + fd=${fd#/proc/self/fd/} + case "$fd" in + 0|1|2) ;; # STDIN STDOUT STDERR + *) exec {fd}<&- ;; + esac + done +} + case $1 in start) log_daemon_msg "Starting web server" "apache2" @@ -177,6 +189,7 @@ . "/usr/share/univention-config-registry/init-autostart.lib" check_autostart apache2 apache2/autostart fi + close_fds if $APACHE2CTL start; then if check_htcacheclean ; then log_progress_msg htcacheclean @@ -226,7 +239,7 @@ fi if $APACHE2CTL graceful $2 ; then log_end_msg 0 - if ! timeout 1 apache2ctl status >/dev/null; then + if ! timeout 5 $APACHE2CTL status >/dev/null; then pkill -9 -f '^/usr/sbin/apache2 -k' $0 restart fi @@ -261,6 +274,7 @@ if ! apache_wait_stop; then log_end_msg 1 || true fi + close_fds if $APACHE2CTL start; then if check_htcacheclean ; then start_htcacheclean || log_end_msg 1 @@ -272,6 +286,7 @@ ;; start-htcacheclean) log_daemon_msg "Starting htcacheclean" + close_fds start_htcacheclean || log_end_msg 1 log_end_msg 0 ;;