<div dir="ltr">The 6:28 time suggests that logrotate is the reason for this, please change postrotate action in /etc/logrotate.d/apache2 to restart apache instead of reloading it.<br></div><div class="gmail_extra"><br><div class="gmail_quote">2015-08-05 10:41 GMT+02:00 Thomas Luft <span dir="ltr"><<a href="mailto:thomas@die-lufts.org" target="_blank">thomas@die-lufts.org</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Jochen,<br>
hi everybody,<br>
<br>
I changed the init.d script but the error persists. The log stopped this morning at 6:28, after that the process is still there but apache does not react.<br>
<br>
Maybe I am changing the wrong file since Debian uses init.d no more?<br>
<br>
I attached my /etc/init.d/apache2 script:<br>
<br>
Regards<br>
<br>
Thomas<br>
<br>
#!/bin/sh<br>
### BEGIN INIT INFO<br>
# Provides: apache2<br>
# Required-Start: $local_fs $remote_fs $network $syslog $named<br>
# Required-Stop: $local_fs $remote_fs $network $syslog $named<br>
# Default-Start: 2 3 4 5<br>
# Default-Stop: 0 1 6<br>
# X-Interactive: true<br>
# Short-Description: Apache2 web server<br>
# Description: Start the web server and associated helpers<br>
# This script will start apache2, and possibly all associated instances.<br>
# Moreover, it will set-up temporary directories and helper tools such as<br>
# htcacheclean when required by the configuration.<br>
### END INIT INFO<br>
<br>
DESC="web server"<br>
NAME=apache2<br>
DAEMON=/usr/sbin/$NAME<br>
<br>
SCRIPTNAME="${0##*/}"<br>
SCRIPTNAME="${SCRIPTNAME##[KS][0-9][0-9]}"<br>
if [ -n "$APACHE_CONFDIR" ] ; then<br>
if [ "${APACHE_CONFDIR##/etc/apache2-}" != "${APACHE_CONFDIR}" ] ; then<br>
DIR_SUFFIX="${APACHE_CONFDIR##/etc/apache2-}"<br>
else<br>
DIR_SUFFIX=<br>
fi<br>
elif [ "${SCRIPTNAME##apache2-}" != "$SCRIPTNAME" ] ; then<br>
DIR_SUFFIX="-${SCRIPTNAME##apache2-}"<br>
APACHE_CONFDIR=/etc/apache2$DIR_SUFFIX<br>
else<br>
DIR_SUFFIX=<br>
APACHE_CONFDIR=/etc/apache2<br>
fi<br>
if [ -z "$APACHE_ENVVARS" ] ; then<br>
APACHE_ENVVARS=$APACHE_CONFDIR/envvars<br>
fi<br>
export APACHE_CONFDIR APACHE_ENVVARS<br>
<br>
ENV="env -i LANG=C PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"<br>
if [ "$APACHE_CONFDIR" != /etc/apache2 ] ; then<br>
ENV="$ENV APACHE_CONFDIR=$APACHE_CONFDIR"<br>
fi<br>
if [ "$APACHE_ENVVARS" != "$APACHE_CONFDIR/envvars" ] ; then<br>
ENV="$ENV APACHE_ENVVARS=$APACHE_ENVVARS"<br>
fi<br>
<br>
<br>
#edit /etc/default/apache2 to change this.<br>
HTCACHECLEAN_RUN=auto<br>
HTCACHECLEAN_MODE=daemon<br>
HTCACHECLEAN_SIZE=300M<br>
HTCACHECLEAN_DAEMON_INTERVAL=120<br>
HTCACHECLEAN_PATH=/var/cache/apache2$DIR_SUFFIX/mod_cache_disk<br>
HTCACHECLEAN_OPTIONS=""<br>
<br>
# Read configuration variable file if it is present<br>
if [ -f /etc/default/apache2$DIR_SUFFIX ] ; then<br>
. /etc/default/apache2$DIR_SUFFIX<br>
elif [ -f /etc/default/apache2 ] ; then<br>
. /etc/default/apache2<br>
fi<br>
<br>
PIDFILE=$(. $APACHE_ENVVARS && echo $APACHE_PID_FILE)<br>
<br>
VERBOSE=no<br>
if [ -f /etc/default/rcS ]; then<br>
. /etc/default/rcS<br>
fi<br>
. /lib/lsb/init-functions<br>
<br>
<br>
# Now, set defaults:<br>
APACHE2CTL="$ENV apache2ctl"<br>
HTCACHECLEAN="$ENV htcacheclean"<br>
PIDFILE=$(. $APACHE_ENVVARS && echo $APACHE_PID_FILE)<br>
APACHE2_INIT_MESSAGE=""<br>
<br>
CONFTEST_OUTFILE=<br>
cleanup() {<br>
if [ -n "$CONFTEST_OUTFILE" ] ; then<br>
rm -f "$CONFTEST_OUTFILE"<br>
fi<br>
}<br>
trap cleanup 0 # "0" means "EXIT", but "EXIT" is not portable<br>
<br>
<br>
apache_conftest() {<br>
[ -z "$CONFTEST_OUTFILE" ] || rm -f "$CONFTEST_OUTFILE"<br>
CONFTEST_OUTFILE=$(mktemp)<br>
if ! $APACHE2CTL configtest > "$CONFTEST_OUTFILE" 2>&1 ; then<br>
return 1<br>
else<br>
rm -f "$CONFTEST_OUTFILE"<br>
CONFTEST_OUTFILE=<br>
return 0<br>
fi<br>
}<br>
<br>
clear_error_msg() {<br>
[ -z "$CONFTEST_OUTFILE" ] || rm -f "$CONFTEST_OUTFILE"<br>
CONFTEST_OUTFILE=<br>
APACHE2_INIT_MESSAGE=<br>
}<br>
<br>
print_error_msg() {<br>
[ -z "$APACHE2_INIT_MESSAGE" ] || log_warning_msg "$APACHE2_INIT_MESSAGE"<br>
if [ -n "$CONFTEST_OUTFILE" ] ; then<br>
echo "Output of config test was:" >&2<br>
cat "$CONFTEST_OUTFILE" >&2<br>
rm -f "$CONFTEST_OUTFILE"<br>
CONFTEST_OUTFILE=<br>
fi<br>
}<br>
<br>
apache_wait_start() {<br>
local STATUS=$1<br>
local i=0<br>
<br>
if [ $STATUS != 0 ] ; then<br>
return $STATUS<br>
fi<br>
while : ; do<br>
PIDTMP=$(pidofproc -p $PIDFILE $DAEMON)<br>
if [ -n "${PIDTMP:-}" ] && kill -0 "${PIDTMP:-}" 2> /dev/null; then<br>
return $STATUS<br>
fi<br>
<br>
if [ $i = "20" ] ; then<br>
APACHE2_INIT_MESSAGE="The apache2$DIR_SUFFIX instance did not start within 20 seconds. Please read the log files to discover problems"<br>
return 2<br>
fi<br>
<br>
[ "$VERBOSE" != no ] && log_progress_msg "."<br>
sleep 1<br>
i=$(($i+1))<br>
done<br>
}<br>
<br>
apache_wait_stop() {<br>
local STATUS=$1<br>
<br>
if [ $STATUS != 0 ] ; then<br>
return $STATUS<br>
fi<br>
<br>
PIDTMP=$(pidofproc -p $PIDFILE $DAEMON)<br>
if [ -n "${PIDTMP:-}" ] && kill -0 "${PIDTMP:-}" 2> /dev/null; then<br>
local i=0<br>
while kill -0 "${PIDTMP:-}" 2> /dev/null; do<br>
if [ $i = '60' ]; then<br>
break<br>
STATUS=2<br>
fi<br>
[ "$VERBOSE" != no ] && log_progress_msg "."<br>
sleep 1<br>
i=$(($i+1))<br>
done<br>
return $STATUS<br>
else<br>
return $STATUS<br>
fi<br>
}<br>
<br>
<br>
#<br>
# Function that starts the daemon/service<br>
#<br>
do_start()<br>
{<br>
# Return<br>
# 0 if daemon has been started<br>
# 1 if daemon was already running<br>
# 2 if daemon could not be started<br>
<br>
if pidofproc -p $PIDFILE "$DAEMON" > /dev/null 2>&1 ; then<br>
return 1<br>
fi<br>
<br>
if apache_conftest ; then<br>
$APACHE2CTL start<br>
apache_wait_start $?<br>
return $?<br>
else<br>
APACHE2_INIT_MESSAGE="The apache2$DIR_SUFFIX configtest failed."<br>
return 2<br>
fi<br>
}<br>
<br>
#<br>
# Function that stops the daemon/service<br>
#<br>
do_stop()<br>
{<br>
# Return<br>
# 0 if daemon has been stopped<br>
# 1 if daemon was already stopped<br>
# 2 if daemon could not be stopped<br>
# other if a failure occurred<br>
<br>
# either "stop" or "graceful-stop"<br>
local STOP=$1<br>
# can't use pidofproc from LSB here<br>
local AP_RET=0<br>
<br>
if pidof $DAEMON > /dev/null 2>&1 ; then<br>
if [ -e $PIDFILE ] && pidof $DAEMON | tr ' ' '\n' | grep -w $(cat $PIDFILE) > /dev/null 2>&1 ; then<br>
AP_RET=2<br>
else<br>
AP_RET=1<br>
fi<br>
else<br>
AP_RET=0<br>
fi<br>
<br>
# AP_RET is:<br>
# 0 if Apache (whichever) is not running<br>
# 1 if Apache (whichever) is running<br>
# 2 if Apache from the PIDFILE is running<br>
<br>
if [ $AP_RET = 0 ] ; then<br>
return 1<br>
fi<br>
<br>
if [ $AP_RET = 2 ] && apache_conftest ; then<br>
$APACHE2CTL $STOP > /dev/null 2>&1<br>
apache_wait_stop $?<br>
return $?<br>
else<br>
if [ $AP_RET = 2 ]; then<br>
clear_error_msg<br>
APACHE2_INIT_MESSAGE="The apache2$DIR_SUFFIX configtest failed, so we are trying to kill it manually. This is almost certainly suboptimal, so please make sure your system is working as you'd expect now!"<br>
killproc -p $PIDFILE $DAEMON<br>
apache_wait_stop $?<br>
return $?<br>
elif [ $AP_RET = 1 ] ; then<br>
APACHE2_INIT_MESSAGE="There are processes named 'apache2' running which do not match your pid file which are left untouched in the name of safety, Please review the situation by hand".<br>
return 2<br>
fi<br>
fi<br>
<br>
}<br>
<br>
<br>
#<br>
# Function that sends a SIGHUP to the daemon/service<br>
#<br>
do_reload() {<br>
if apache_conftest; then<br>
if ! pidofproc -p $PIDFILE "$DAEMON" > /dev/null 2>&1 ; then<br>
APACHE2_INIT_MESSAGE="Apache2 is not running"<br>
return 2<br>
fi<br>
# Replace graceful with full restart because of<br>
# a bug in kolab<br>
$APACHE2CTL restart > /dev/null 2>&1<br>
# $APACHE2CTL graceful > /dev/null 2>&1<br>
return $?<br>
else<br>
APACHE2_INIT_MESSAGE="The apache2$DIR_SUFFIX configtest failed. Not doing anything."<br>
return 2<br>
fi<br>
}<br>
<br>
<br>
check_htcacheclean() {<br>
[ "$HTCACHECLEAN_MODE" = "daemon" ] || return 1<br>
[ "$HTCACHECLEAN_RUN" = "yes" ] && return 0<br>
<br>
MODSDIR=$(. $APACHE_ENVVARS && echo $APACHE_MODS_ENABLED)<br>
[ "$HTCACHECLEAN_RUN" = "auto" \<br>
-a -e ${MODSDIR:-$APACHE_CONFDIR/mods-enabled}/cache_disk.load ] && \<br>
return 0<br>
return 1<br>
}<br>
<br>
start_htcacheclean() {<br>
$HTCACHECLEAN $HTCACHECLEAN_OPTIONS -d$HTCACHECLEAN_DAEMON_INTERVAL \<br>
-i -p$HTCACHECLEAN_PATH -l$HTCACHECLEAN_SIZE<br>
}<br>
<br>
stop_htcacheclean() {<br>
pkill -P 1 -f "htcacheclean.* -p$HTCACHECLEAN_PATH " 2> /dev/null || return 1<br>
}<br>
<br>
<br>
# Sanity checks. They need to occur after function declarations<br>
[ -x $DAEMON ] || exit 0<br>
<br>
if [ ! -x $DAEMON ] ; then<br>
echo "No apache-bin package installed"<br>
exit 0<br>
fi<br>
<br>
if [ -z "$PIDFILE" ] ; then<br>
echo ERROR: APACHE_PID_FILE needs to be defined in $APACHE_ENVVARS >&2<br>
exit 2<br>
fi<br>
<br>
if check_htcacheclean ; then<br>
if [ ! -d "$HTCACHECLEAN_PATH" ] ; then<br>
echo "htcacheclean is configured, but directory $HTCACHECLEAN_PATH does not exist!" >&2<br>
exit 2<br>
fi<br>
fi<br>
<br>
<br>
<br>
case "$1" in<br>
start)<br>
log_daemon_msg "Starting $DESC" "$NAME"<br>
do_start<br>
RET_STATUS=$?<br>
case "$RET_STATUS" in<br>
0|1)<br>
log_success_msg<br>
[ "$VERBOSE" != no ] && [ $RET_STATUS = 1 ] && log_warning_msg "Server was already running"<br>
if check_htcacheclean ; then<br>
[ "$VERBOSE" != no ] && log_daemon_msg "Starting HTTP cache cleaning daemon" "htcacheclean"<br>
start_htcacheclean<br>
[ "$VERBOSE" != no ] && log_end_msg $?<br>
fi<br>
;;<br>
2)<br>
log_failure_msg<br>
print_error_msg<br>
exit 1<br>
;;<br>
esac<br>
;;<br>
stop|graceful-stop)<br>
log_daemon_msg "Stopping $DESC" "$NAME"<br>
do_stop "$1"<br>
RET_STATUS=$?<br>
case "$RET_STATUS" in<br>
0|1)<br>
log_success_msg<br>
[ "$VERBOSE" != no ] && [ $RET_STATUS = 1 ] && log_warning_msg "Server was not running"<br>
;;<br>
2)<br>
log_failure_msg<br>
print_error_msg<br>
exit 1<br>
;;<br>
esac<br>
print_error_msg<br>
<br>
if check_htcacheclean ; then<br>
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping HTTP cache cleaning daemon" "htcacheclean"<br>
stop_htcacheclean<br>
[ "$VERBOSE" != no ] && log_end_msg $?<br>
fi<br>
<br>
;;<br>
status)<br>
status_of_proc -p $PIDFILE "apache2" "$NAME"<br>
exit $?<br>
;;<br>
reload|force-reload|graceful)<br>
log_daemon_msg "Reloading $DESC" "$NAME"<br>
do_reload<br>
RET_STATUS=$?<br>
case "$RET_STATUS" in<br>
0|1)<br>
log_success_msg<br>
[ "$VERBOSE" != no ] && [ $RET_STATUS = 1 ] && log_warning_msg "Server was already running"<br>
;;<br>
2)<br>
log_failure_msg<br>
print_error_msg<br>
exit 1<br>
;;<br>
esac<br>
print_error_msg<br>
;;<br>
restart)<br>
log_daemon_msg "Restarting $DESC" "$NAME"<br>
do_stop stop<br>
case "$?" in<br>
0|1)<br>
do_start<br>
case "$?" in<br>
0)<br>
log_end_msg 0<br>
;;<br>
1|*)<br>
log_end_msg 1 # Old process is still or failed to running<br>
print_error_msg<br>
exit 1<br>
;;<br>
esac<br>
;;<br>
*)<br>
# Failed to stop<br>
log_end_msg 1<br>
print_error_msg<br>
exit 1<br>
;;<br>
esac<br>
;;<br>
start-htcacheclean)<br>
log_daemon_msg "Starting htcacheclean"<br>
start_htcacheclean<br>
log_end_msg $?<br>
exit $?<br>
;;<br>
stop-htcacheclean)<br>
log_daemon_msg "Stopping htcacheclean"<br>
stop_htcacheclean<br>
log_end_msg $?<br>
exit $?<br>
;;<br>
*)<br>
echo "Usage: $SCRIPTNAME {start|stop|graceful-stop|restart|reload|force-reload|start-htcacheclean|stop-htcacheclean}" >&2<br>
exit 3<br>
;;<br>
esac<br>
<br>
exit 0<br>
<br>
# vim: syntax=sh ts=4 sw=4 sts=4 sr noet<span class="im HOEnZb"><br>
<br>
Am 03.08.2015 um 23:57 schrieb Jochen Hein:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Thomas Luft <<a href="mailto:thomas@die-lufts.org" target="_blank">thomas@die-lufts.org</a>> writes:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I started with apachectl but there was no output at all. After the start<br>
I can use the web server for some time, then suddenly and without reason<br>
it crashes but the process is still there (I checked via ps -x).<br>
</blockquote>
Is this after logrotate and "apachectl reload"? Please use restart<br>
instead of reload...<br>
<br>
Jochen<br>
<br>
</blockquote>
<br></span><div class="HOEnZb"><div class="h5">
_______________________________________________<br>
users mailing list<br>
<a href="mailto:users@lists.kolab.org" target="_blank">users@lists.kolab.org</a><br>
<a href="https://lists.kolab.org/mailman/listinfo/users" rel="noreferrer" target="_blank">https://lists.kolab.org/mailman/listinfo/users</a><br>
</div></div></blockquote></div><br></div>