|
1 |
#!/bin/sh |
1 |
#!/bin/bash |
2 |
### BEGIN INIT INFO |
2 |
### BEGIN INIT INFO |
3 |
# Provides: apache2 |
3 |
# Provides: apache2 |
4 |
# Required-Start: $local_fs $remote_fs $network $syslog $named |
4 |
# Required-Start: $local_fs $remote_fs $network $syslog $named |
|
169 |
fi |
169 |
fi |
170 |
} |
170 |
} |
171 |
|
171 |
|
|
|
172 |
close_fds () { |
173 |
local fd |
174 |
for fd in /proc/self/fd/* |
175 |
do |
176 |
fd=${fd#/proc/self/fd/} |
177 |
case "$fd" in |
178 |
0|1|2) ;; # STDIN STDOUT STDERR |
179 |
*) exec {fd}<&- ;; |
180 |
esac |
181 |
done |
182 |
} |
183 |
|
172 |
case $1 in |
184 |
case $1 in |
173 |
start) |
185 |
start) |
174 |
log_daemon_msg "Starting web server" "apache2" |
186 |
log_daemon_msg "Starting web server" "apache2" |
|
177 |
. "/usr/share/univention-config-registry/init-autostart.lib" |
189 |
. "/usr/share/univention-config-registry/init-autostart.lib" |
178 |
check_autostart apache2 apache2/autostart |
190 |
check_autostart apache2 apache2/autostart |
179 |
fi |
191 |
fi |
|
|
192 |
close_fds |
180 |
if $APACHE2CTL start; then |
193 |
if $APACHE2CTL start; then |
181 |
if check_htcacheclean ; then |
194 |
if check_htcacheclean ; then |
182 |
log_progress_msg htcacheclean |
195 |
log_progress_msg htcacheclean |
|
226 |
fi |
239 |
fi |
227 |
if $APACHE2CTL graceful $2 ; then |
240 |
if $APACHE2CTL graceful $2 ; then |
228 |
log_end_msg 0 |
241 |
log_end_msg 0 |
229 |
if ! timeout 1 apache2ctl status >/dev/null; then |
242 |
if ! timeout 5 $APACHE2CTL status >/dev/null; then |
230 |
pkill -9 -f '^/usr/sbin/apache2 -k' |
243 |
pkill -9 -f '^/usr/sbin/apache2 -k' |
231 |
$0 restart |
244 |
$0 restart |
232 |
fi |
245 |
fi |
|
261 |
if ! apache_wait_stop; then |
274 |
if ! apache_wait_stop; then |
262 |
log_end_msg 1 || true |
275 |
log_end_msg 1 || true |
263 |
fi |
276 |
fi |
|
|
277 |
close_fds |
264 |
if $APACHE2CTL start; then |
278 |
if $APACHE2CTL start; then |
265 |
if check_htcacheclean ; then |
279 |
if check_htcacheclean ; then |
266 |
start_htcacheclean || log_end_msg 1 |
280 |
start_htcacheclean || log_end_msg 1 |
|
272 |
;; |
286 |
;; |
273 |
start-htcacheclean) |
287 |
start-htcacheclean) |
274 |
log_daemon_msg "Starting htcacheclean" |
288 |
log_daemon_msg "Starting htcacheclean" |
|
|
289 |
close_fds |
275 |
start_htcacheclean || log_end_msg 1 |
290 |
start_htcacheclean || log_end_msg 1 |
276 |
log_end_msg 0 |
291 |
log_end_msg 0 |
277 |
;; |
292 |
;; |