apache shuts down

14 posts / 0 new
Last post
#1 Sun, 05/10/2009 - 02:25
cyberthom

apache shuts down

heya.. im having a bit of a problem with apache lately.. it seems to shut down by itself every now and again.. when i try to restart it it gives me an error message that the port (80) is already in use.. looking through the apache error log file i found the following line:

[Sun May 10 06:25:25 2009] [notice] caught SIGTERM, shutting down

i google for that error message and found that this is most likely caused by some problematic cron file.. the problem is i didnt setup a cron script that periodically restarts the server itself or just apache..

is there anything like that implemented in virtualmin causing this problem? or any other ideas what could cause this?

(im on the latest virtualmin version)

Sun, 05/10/2009 - 02:32
Joe
Joe's picture

Your OS/version, and Apache package version would probably be relevant here.

There will be log rotations on any system, including Virtualmin. So, there will be a cronjob that is sending a SIGHUP (not a SIGTERM, as far as I know...but again, the OS is probably relevant, since we use the OS standard tools for most of the stuff we do with Apache) when the logs are rotated. I believe rotations happen weekly.

Something more specific than "now and again" could also be useful to know.

There is a known bug on Ubuntu, where the server team has broken the Apache initscript such that a restart will leave Apache in a zombie state (pretty much like you describe) if you have any SSL sites or if your server is pretty active. But, there would have to be something happening that triggers a restart using the initscript. Adding a virtual server with SSL or a new IP in Virtualmin could do it.

--

Check out the forum guidelines!

Sun, 05/10/2009 - 03:06 (Reply to #2)
cyberthom

OS: Debian Linux 4.0 (Linux 2.6.18-6-amd64 on x86_64)
Apache: apache2 2.2.3-50vm

ive looked for all SIGTERM occurences in the apache error log:

[Sun Jan 25 06:25:05 2009] [notice] caught SIGTERM, shutting down
[Sun Feb 01 06:25:06 2009] [notice] caught SIGTERM, shutting down
[Sun Feb 08 06:25:06 2009] [notice] caught SIGTERM, shutting down
[Sat Feb 14 01:02:02 2009] [notice] caught SIGTERM, shutting down
[Sun Feb 15 06:25:20 2009] [notice] caught SIGTERM, shutting down
[Sun Feb 22 06:25:24 2009] [notice] caught SIGTERM, shutting down
[Sun Mar 01 06:25:06 2009] [notice] caught SIGTERM, shutting down
[Sun Mar 08 06:25:05 2009] [notice] caught SIGTERM, shutting down
[Sun Mar 15 06:25:05 2009] [notice] caught SIGTERM, shutting down
[Sun Mar 22 06:25:25 2009] [notice] caught SIGTERM, shutting down
[Mon Mar 30 06:25:04 2009] [notice] caught SIGTERM, shutting down
[Sun Apr 05 06:25:22 2009] [notice] caught SIGTERM, shutting down
[Sun Apr 12 06:25:17 2009] [notice] caught SIGTERM, shutting down
[Sun Apr 19 06:25:21 2009] [notice] caught SIGTERM, shutting down
[Sun Apr 26 06:25:18 2009] [notice] caught SIGTERM, shutting down
[Sun May 03 06:25:26 2009] [notice] caught SIGTERM, shutting down
[Sun May 10 06:25:25 2009] [notice] caught SIGTERM, shutting down

some of these are obviously intended restarts but there seems to be a pattern on sunday around 6.. i have a scheduled backup on sunday (Backup and Restore > Scheduled Backup).. i also have one SSL site running but the server isn't overly busy at all.. should i just disable the backup? (although i do like to keep one)

thanks for your help - much appreciated!

Sun, 05/10/2009 - 12:04 (Reply to #3)
Joe
Joe's picture

<div class='quote'>should i just disable the backup?</div>

Egads! Why would that ever be your first instinct? Disabling backups is a horrible idea. ;-)

So, it happens at pretty much the exact same time on Sunday. And a bonus on Monday and Saturday (at the same and different time respectively). This tells me there is a cronjob doing the damage here.

So, what cronjob is configured to run at 6:25AM every Sunday, and on the last day of the month? (The odd man out on Saturday will probably be something else.) Webmin has a Cron Jobs module where you can see roots jobs.

--

Check out the forum guidelines!

Sun, 05/10/2009 - 12:45
cyberthom

the only cronjob i found that is scheduled for 6:25 is:
---
/etc/cron.daily/webalizer
/etc/cron.daily/apt
/etc/cron.daily/man-db
/etc/cron.daily/find
/etc/cron.daily/standard
/etc/cron.daily/bsdmainutils
/etc/cron.daily/quota
/etc/cron.daily/aptitude
/etc/cron.daily/sysklogd
/etc/cron.daily/logrotate
---
but that runs every day so it's odd that it always seems to crash on sunday..

well and then there's the backup cron job of course scheduled for @weekly (every sunday) - doesnt state the exact time though:
---
/etc/webmin/virtual-server/backup.pl --id ###############
--

does that give any clues? im not sure what could clash with apache.. maybe webalizer?

Sun, 05/10/2009 - 13:12 (Reply to #5)
Joe
Joe's picture

logrotate reloads Apache, as I mentioned in the first response. Apache has to become root again to re-open the logs, so it takes a hard start whenever the logs are deleted...which would be once a week, most likely.

So, we need to figure out what logrotate is calling to restart Apache each week, and why that kind of restart is leaving your Apache dead in the water.

So, look in your logrotate configuration (/etc/logrotate.d/apache2) and see what restart command is being used. Then try it yourself. See what happens.

Any errors? Anything in the log?

--

Check out the forum guidelines!

Sun, 05/10/2009 - 13:21 (Reply to #6)
cyberthom

---

postrotate
if [ -f /var/run/apache2.pid ]; then
/etc/init.d/apache2 restart &gt; /dev/null
fi
endscript
---

'/etc/init.d/apache2 restart' seems to work fine.. just tried it out.. this is odd - your explanation made sense.. anything else i can try?

Sun, 05/10/2009 - 13:47 (Reply to #7)
Joe
Joe's picture

Hmmm...Maybe there's something else doing rotations. Maybe webalizer, maybe something else. Virtualmin has its own log processing tools for virtual hosts, which also could trigger something (in that case the restart command would be configured by the Webmin-&gt;Apache module).

But, since this is always happening at 6:25, I think we really want to blame something in that list of cron.daily jobs. So, take a look at the webalizer config as a start.

--

Check out the forum guidelines!

Sun, 08/19/2018 - 15:31
neilticktin

Did you ever figure this out? We're seeing the same thing ... around 6:30am on Sun. But, it's happened other days. Have even tried a completely fresh OS and webmin install to make sure there wasn't some crazy setting we were missing. I see nothing in cron jobs at that time -- not even in some WordPress plugin that's running on that server. (We also have a similar WordPress setup on another server, and it never does this).

Any ideas?

Sun, 08/19/2018 - 16:08
Jfro

Please read forum rules first. As for versions for example.

Sun, 08/19/2018 - 20:10 (Reply to #10)
neilticktin

I'm sorry, are you saying that I don't have an appropriate question? I'm baffled as to why you're suggesting that I read the forum rules.

Mon, 08/20/2018 - 05:11 (Reply to #11)
Jfro

UH you even didn't read my post to the end? VERSIONS, LOGFILES error messages, config settings al needed to get support in a support forum is that so hard to understand, or reading? ;)

Even reading from this topic start at post 2 https://www.virtualmin.com/comment/702401#comment-702401

Your OS/version, and Apache package version would probably be relevant here.

So shouldn't be so hard to understand if reading well and complete. ;) Starting here i suggest https://www.virtualmin.com/node/53663

Mon, 08/20/2018 - 12:07
neilticktin

jfro: I'm sorry to have offended. I simply asked if they figured it out. I would have taken that answer and looked into our system further before posting again (e.g., support). Since my question seems to be viewed as a direct support question, and not what I was intending ... to see what the end result for the other user was ... I'll repost the question in a new thread with th details.

Or, if you happen to know the end result of this thread, that's all that I was asking at this point.

Mon, 08/20/2018 - 13:06
Jfro

Ok metoo

no i'm not but very old posts 9 years makes no sense to bring up.

Better as in forumrules open then a new one with all info's so all is up to date, while a 9 year old post you hopefully never have the same versions. ;) therefore it shouldn't be same problem only lookalike..

Topic locked