in short:

  • running production webserver
  • tuesday: changed config (the change was erroneous, wrong syntax) but deliberately not restarted apache
  • apache restarted or reloaded config by itself today @cron.daily time
  • apache was down

why apache restarted or reloaded config by itself?

long version

on my debian lenny stable server, which has a quite default setup (apache2, mod_php, mysql client, apc,...) i made a change to my apc.ini where i was not sure if it is faulty or not, because it is an production server, i just safed the file without restarting the webserver.

today @cron.daily time (6:25), the server restarted itself and stayed down because of the faulty apc.ini. i really want to know, why the server restarted itself. also why today? it is the cron.daily time and not the weekly time, the faulty config is online since tuesday.


# m h dom mon dow user  command
17 *    * * *   root    cd / && run-parts --report /etc/cron.hourly
25 6    * * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6    * * 7   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6    1 * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )

cron.daily content:


cron.weekly content:


any ideas?

edit: added logrotate tag based on the selected answer


cron run logrotate, logrotate reload Apache:

/var/log/apache2/*.log {
                if [ -f "`. /etc/apache2/envvars ; echo ${APACHE_PID_FILE:-/var/run/apache2.pid}`" ]; then
                        /etc/init.d/apache2 reload > /dev/null
  • thank you. it was a faulty value for in apc.ini ;apc.shm_size=2G ;apc.shm_size=2048 ;apc.shm_size=2048M was not sure which is the right one (differs from apc version), not sure if apache configtest also works for that. – c33s Feb 20 '11 at 12:06
  • The "reload" option is the equivalent of "apache2ctl graceful" (on debian, anyway), which is supposed to do a configtest before reloading. I'm surprised it was willing to kill apache with a bad config. – akramer Feb 21 '11 at 1:42

maybe i'm wrong i'm not sure but i think that when apache web server crashes init.d restarts it automatically, also it depends on the environment and configuration of apache (e.g. what OS or Linux Distribution you are using)

  • 1
    Init.d does not restart anything automatically. There are services that are used for monitoring of other, and in case of failure restart them, but init.d is not a service, just mere location where init scripts are stored. – Hrvoje Špoljar Feb 20 '11 at 13:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.