error.log for apache2 contains lots of "caught SIGTERM" notices
Solution 1
The SIGTERM
is simply a POSIX process signal that tells the system how to stop a process; in this case Apache. As per that Wikipedia link:
The SIGTERM signal is sent to a process to request its termination. Unlike the SIGKILL signal, it can be caught and interpreted or ignored by the process. This allows the process to perform nice termination releasing resources and saving state if appropriate. SIGINT is nearly identical to SIGTERM.
Which basically all means that when you tell Apache to stop
via the command:
sudo service apache2 stop
Or restart
via this command:
sudo service apache2 restart
What is actually happening is the init.d
script is sending a SIGTERM
to the process and the log is just reflecting that. Which all means that it’s politely asking Apache2 to stop what it is doing.
Now the benefit of the log is to simply let you know what is happening. For example, let’s say you are on a real world server and under DDoS attack. The system might be so overwhelmed you don’t see that caught SIGTERM, shutting down
entry in the log right away. Heck, the whole “stop the process” logic might just choke and that never shows up in the log.
The benefit of that log entry is for the system to confirm that yes, we received the order to shutdown Apache and yes this is what was done.
Solution 2
This is totally normal, as it is the way your script stops apache.
Check your /etc/init.d/apache2
or /etc/init.d/httpd
script (the name depends on OS), you should see somehting like :
stop() {
echo -n $"Stopping $prog: "
killproc -p ${pidfile} -d ${STOP_TIMEOUT} $httpd
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile}
}
The command killproc
sends a SIGTERM to the httpd process.
Related videos on Youtube
![slhck](https://i.stack.imgur.com/jyNn1.png?s=256&g=1)
slhck
Updated on September 18, 2022Comments
-
slhck almost 2 years
When I restart my apache services it generates the following log in
/var/log/apache2/error.log
– and it increases the size oferror.log
.Is that default behaviour or am I missing some configuration?
[Mon Jul 29 15:13:25 2013] [notice] Apache/2.2.22 (Ubuntu) PHP/5.4.9-4ubuntu2.2 configured -- resuming normal operations [Mon Jul 29 15:14:24 2013] [notice] caught SIGTERM, shutting down [Mon Jul 29 15:14:25 2013] [notice] Apache/2.2.22 (Ubuntu) PHP/5.4.9-4ubuntu2.2 configured -- resuming normal operations [Mon Jul 29 15:14:31 2013] [notice] caught SIGTERM, shutting down [Mon Jul 29 15:14:32 2013] [notice] Apache/2.2.22 (Ubuntu) PHP/5.4.9-4ubuntu2.2 configured -- resuming normal operations [Mon Jul 29 15:14:59 2013] [notice] caught SIGTERM, shutting down [Mon Jul 29 15:15:00 2013] [notice] Apache/2.2.22 (Ubuntu) PHP/5.4.9-4ubuntu2.2 configured -- resuming normal operations [Mon Jul 29 15:15:02 2013] [notice] caught SIGTERM, shutting down [Mon Jul 29 15:15:03 2013] [notice] Apache/2.2.22 (Ubuntu) PHP/5.4.9-4ubuntu2.2 configured -- resuming normal operations