Question

Graceful restart requested, doing restart

Posted November 9, 2013 33.4k views
Hello, every sunday morning my Ubuntu server does a restart and I dont know why. These are the messages from the log files: [Sun Nov 03 07:35:03 2013] [notice] Graceful restart requested, doing restart [Sun Nov 03 07:35:04 2013] [notice] Apache/2.2.22 (Ubuntu) PHP/5.4.17-5+debphp.org~precise+1 configured -- resuming normal operations (If it has to do anything with PHP I used these lines when I updated PHP to version 5.4) : sudo apt-get install python-software-properties apt-get dist-upgrade sudo apt-get upgrade sudo add-apt-repository ppa:ondrej/php5-oldstable sudo apt-get update sudo apt-get upgrade Thanks in advance!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
Submit an Answer
10 answers
Please pastebin the whole log file. Upgrading php restarts apache automatically but I don't think you're upgrading php every week so the whole log file would help :]
Thanks for your answer Kamal,

No ofc im not, but since I have no idea whats causing the restart I just thought php could have something to do with it since I saw it in the log.

Since it was sunday yday I got the same message.

[Sun Nov 10 07:35:02 2013] [notice] Graceful restart requested, doing restart
[Sun Nov 10 07:35:03 2013] [notice] Apache/2.2.22 (Ubuntu) PHP/5.4.17-5+debphp.org~precise+1 configured -- resuming normal operations

Thats everything from the log "/var/log/apache2/error.log" The rest in the log is just some simple php errors which has nothing to do with it.

Thanks in advance
Odd. Apparently Apache gracefully restarts when editing config files but gracefully restarting/reloading *every* sunday is weird.
I am seeing this happen on my server as well. I'll continue to monitor the logs and see if it is happening at other times when I have not requested it. Here is the line from when it happened this morning

[Sun Jan 26 06:36:23 2014] [notice] Graceful restart requested, doing restart

This server is located in NYC2 and I have not changed the timezone setting of the server. I can assure you that I did not request the restart at this time.

I have seen a suggestion in another forum (http://forums.cpanel.net/f5/apache-graceful-restart-requested-log-file-158026.html#post664414) that configuration settings may need to be adjusted and am assuming that's where people are able to adjust their apache configuration. However, if this is really an issue with apache config, it should happen at various unpredictable times and not always on a Sunday. I don't believe that I am seeing it happen at other times when I have not requested it.
I looked through more of the results I got from searching on "apache2 graceful restart" and am including some results that may (although I'm not certain -- see comments with each) be relevant.

http://dripuonlinux.wordpress.com/2013/02/08/apache-undergoing-graceful-restart-every-two-hours/ - the interesting point is that the poster says it is related to log processing. However, the solution provided deals with configuring cPanel. So, I'm not sure this really applies to us on D.O. Perhaps I should look into the logrotate settings and see if it just so happens that something happens every Sunday?

http://us.generation-nt.com/answer/gentoo-user-apache-what-could-cause-graceful-restart-requested-help-204315671.html - This post seems to confirm my thought that it may related to logrotate. I read further down the thread (http://us.generation-nt.com/answer/gentoo-user-apache-what-could-cause-graceful-restart-requested-help-204315671.html#204316391) and see the specific information from logrotate as well as answers from posters about why the graceful restart is necessary.

I'm going to look into my logrotate configuration now.
Indeed, here is my logrotate configuration for apache:

/var/log/apache2/*.log {
weekly
missingok
rotate 52
compress
delaycompress
notifempty
create 640 root adm
sharedscripts
postrotate
/etc/init.d/apache2 reload > /dev/null
endscript
prerotate
if [ -d /etc/logrotate.d/httpd-prerotate ]; then \
run-parts /etc/logrotate.d/httpd-prerotate; \
fi; \
endscript
}

Notice that it is done weekly and it issues a reload postrotation. I think the mystery is solved.

For me, this actually has a nice side benefit that my APC cache will automatically be flushed once a week. The thing that had triggered me to look into this in the first place was that I was inspecting my APC cache statistics and noticed that it was using less memory than I expected. I was concerned that it had filled up, but saw that cache full was zero. Then I noticed that it had been running for just over an hour. So, I checked my log files and noticed the Graceful restart. And, now here we are at the resolution. Cheers!
Ah, sorry. I had wrapped the last paragraph in a set of tangent tags, but they are being hidden; apparently they are being interpreted as actual HTML markup and being stripped as unrecognized. I guess I needed to use < and > notation. (Let's see if the HTML entity coding works.)
If you run cPanel on your server you can fix this by going to WHM panel at:
Service Configuration » Apache Configuration » Piped Log Configuration, checkbox "Enable Piped Apache Logs" then "Save".

That worked for me on CentOS 6.5.

Hi. Im having the same problem, but in my case, the apache restart is restarting frequently, see my error log:

[Sun Nov 15 00:11:36.895033 2020] [core:notice] [pid 13438] AH00094: Command line: '/usr/sbin/apache2'
[Sun Nov 15 00:12:47.058426 2020] [mpm_prefork:notice] [pid 13438] AH00171: Graceful restart requested, doing restart
[Sun Nov 15 00:12:47.598797 2020] [ssl:warn] [pid 13438] AH01909: www.universonoobz.com.br:443:0 server certificate does NOT include an ID which matches the server name
[Sun Nov 15 00:12:48.003024 2020] [mpm_prefork:notice] [pid 13438] AH00163: Apache/2.4.29 (Ubuntu) OpenSSL/1.1.1 configured -- resuming normal operations
[Sun Nov 15 00:12:48.003055 2020] [core:notice] [pid 13438] AH00094: Command line: '/usr/sbin/apache2'
[Sun Nov 15 00:12:54.820531 2020] [mpm_prefork:notice] [pid 13438] AH00171: Graceful restart requested, doing restart
[Sun Nov 15 00:12:55.221861 2020] [ssl:warn] [pid 13438] AH01909: www.universonoobz.com.br:443:0 server certificate does NOT include an ID which matches the server name
[Sun Nov 15 00:12:55.455911 2020] [ssl:warn] [pid 13438] AH01909: www.familiafooddelivery.com:443:0 server certificate does NOT include an ID which matches the server name
[Sun Nov 15 00:12:55.571234 2020] [mpm_prefork:notice] [pid 13438] AH00163: Apache/2.4.29 (Ubuntu) OpenSSL/1.1.1 configured -- resuming normal operations
[Sun Nov 15 00:12:55.571263 2020] [core:notice] [pid 13438] AH00094: Command line: '/usr/sbin/apache2'
[Sun Nov 15 00:13:17.307437 2020] [core:error] [pid 13438] AH00546: no record of generation 24 of exiting child 30316
[Sun Nov 15 00:13:43.954317 2020] [core:error] [pid 13438] AH00546: no record of generation 6 of exiting child 24369
[Sun Nov 15 00:13:57.977622 2020] [core:error] [pid 13438] AH00546: no record of generation 8 of exiting child 25018
[Sun Nov 15 00:14:02.987831 2020] [core:error] [pid 13438] AH00546: no record of generation 20 of exiting child 28441
[Sun Nov 15 00:14:05.495595 2020] [mpm_prefork:notice] [pid 13438] AH00171: Graceful restart requested, doing restart
[Sun Nov 15 00:14:06.213564 2020] [ssl:warn] [pid 13438] AH01909: www.universonoobz.com.br:443:0 server certificate does NOT include an ID which matches the server name
[Sun Nov 15 00:14:06.455696 2020] [ssl:warn] [pid 13438] AH01909: www.familiafooddelivery.com:443:0 server certificate does NOT include an ID which matches the server name
[Sun Nov 15 00:14:06.637107 2020] [mpm_prefork:notice] [pid 13438] AH00163: Apache/2.4.29 (Ubuntu) OpenSSL/1.1.1 configured -- resuming normal operations
[Sun Nov 15 00:14:06.637159 2020] [core:notice] [pid 13438] AH00094: Command line: '/usr/sbin/apache2'
[Sun Nov 15 00:14:13.450406 2020] [mpm_prefork:notice] [pid 13438] AH00171: Graceful restart requested, doing restart
[Sun Nov 15 00:14:14.097504 2020] [ssl:warn] [pid 13438] AH01909: www.familiafooddelivery.com:443:0 server certificate does NOT include an ID which matches the server name
[Sun Nov 15 00:14:14.211056 2020] [mpm_prefork:notice] [pid 13438] AH00163: Apache/2.4.29 (Ubuntu) OpenSSL/1.1.1 configured -- resuming normal operations
[Sun Nov 15 00:14:14.211132 2020] [core:notice] [pid 13438] AH00094: Command line: '/usr/sbin/apache2'
[Sun Nov 15 00:14:36.925862 2020] [core:error] [pid 13438] AH00546: no record of generation 26 of exiting child 30450

Please, help me. Thanks.

logrotate content:

# see "man logrotate" for details
# rotate log files weekly
weekly

# use the syslog group by default, since this is the owning group
# of /var/log/syslog.
su root syslog

# keep 4 weeks worth of backlogs
rotate 4

# create new (empty) log files after rotating old ones
create

# uncomment this if you want your log files compressed
#compress

# packages drop log rotation information into this directory
include /etc/logrotate.d

# no packages own wtmp, or btmp -- we'll rotate them here
/var/log/wtmp {
    missingok
    monthly
    create 0664 root utmp
    rotate 1
}

/var/log/btmp {
    missingok
    monthly
    create 0660 root utmp
    rotate 1
}

# system-specific logs may be configured here

Could the cause of this problem be the fact that I am calling date_default_timezone_set() at times?

Thanks!