LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 03-21-2004, 03:11 PM   #1
pezzer55
LQ Newbie
 
Registered: Feb 2004
Posts: 16

Rep: Reputation: 0
Apache crash on cron->logrotate (weekly)


I;ve recently purchased a linux server. It's got fedora core 1 (updated). I am using apache 2 (as distributed i think with the exception of php, which i am using the latest 5.x beta (dist version leaks php ini settings from .htaccess folders into other folders).

It all works fine, untill 4am sunday morning when cron runs it's weekly stuff.

Apache then dies - or more specifically starts giving error 500 responses to all requests.

"service restart apache" fixes it, failing to stop it, but starts it fine.

The last lines in the apache error log are:

Code:
[Sun Mar 14 04:02:02 2004] [notice] SIGHUP received.  Attempting to restart
[Sun Mar 14 04:02:02 2004] [notice] seg fault or similar nasty error detected in
 the parent process
Once this had happened for the second time on consecutive sundays at 4am... i checked cron and started searching for clues. I eventually traced it to logrotate - specificly "/etc/logrotate.d/httpd".

This file has for the "postrotate" section:
Code:
/bin/kill -HUP `cat /var/run/httpd.pid 2>/dev/null` 2> /dev/null || true
which if executed causes this problem!

So my questions,

1. Any idea as to why this is happening?

2. What can i do about it?

I guess this line is used to restart apache so that it starts using new log files. Can i replace this with:

Code:
/sbin/service httpd restart 2>/dev/null || true
To me that would seem to acheive the desired effect (restart apache), but would also bring it back up

Would there be any issues with doing this?
 
Old 03-22-2004, 03:10 AM   #2
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: NetBSD, Void, Debian, Mint, Ubuntu, Puppy, Raspbian
Posts: 3,487

Rep: Reputation: 233Reputation: 233Reputation: 233
I guess it is killing apache so as to rotate it's log file?
But i think if you send a HUP to it it will just try and restart.
So perhaps apache is trying to write to a log file that's been moved?

all guesswork of course ;-)

can you not maybe:

Code:
/sbin/service httpd stop

   do the rotate bit...

/sbin/service httpd start
just a guess mind,

billy
 
Old 03-22-2004, 04:59 AM   #3
pezzer55
LQ Newbie
 
Registered: Feb 2004
Posts: 16

Original Poster
Rep: Reputation: 0
No idea. It's coming from the standard httpd logrotate file:

"cat /etc/logrotate.d/httpd" gives:
Code:
/var/log/httpd/*log {
    missingok
    notifempty
    sharedscripts
    postrotate
        /bin/kill -HUP `cat /var/run/httpd.pid 2>/dev/null` 2> /dev/null || true
    endscript
}
This is as distributed, (i havnt touched it!) so i dont understand why it shouldnt work!

The kill line should cause apache to reload it config, etc.

I just tried: "service httpd reload" which also uses this method, and that also causes apache to die.

I think i'll just set the postrotare to "service httpd restart" and see what happens next sunday
 
Old 03-22-2004, 05:04 AM   #4
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: NetBSD, Void, Debian, Mint, Ubuntu, Puppy, Raspbian
Posts: 3,487

Rep: Reputation: 233Reputation: 233Reputation: 233
Quote:
This is as distributed, (i havnt touched it!) so i dont understand why it shouldnt work!
ahem! you really should know better than that!

should it not, maybe, remove the .pid file after doing the
HUP? Or am i being stoopid?

Can't say I know much about logrotate.

Just ignore me when I'm irrelevent ;-)


billy
 
Old 03-22-2004, 05:32 AM   #5
pezzer55
LQ Newbie
 
Registered: Feb 2004
Posts: 16

Original Poster
Rep: Reputation: 0
Apache doesnt use "kill -HUP" to exit, it uses it to reload config, restart listeners, etc. It works a treat on my local machine.

So i dont think it should remove the pid file, as the main process will still exist.

The apache init.d script uses this same method for "reload".

The init.d script uses the proprer full shutdown, remove pid file, and startup cycle for "restart". So i guess this will solve my problem, but it wont fix it (somthing is still causing crashes!)
 
Old 03-22-2004, 05:46 AM   #6
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: NetBSD, Void, Debian, Mint, Ubuntu, Puppy, Raspbian
Posts: 3,487

Rep: Reputation: 233Reputation: 233Reputation: 233
you obviously know more than me!

I'll shut up now ;-)
 
Old 03-22-2004, 06:11 AM   #7
pezzer55
LQ Newbie
 
Registered: Feb 2004
Posts: 16

Original Poster
Rep: Reputation: 0
Quote:
Originally posted by bigearsbilly
you obviously know more than me!

I'll shut up now ;-)
all guesswork, and following a trail of shell scripts

didnt know this stuff this time yesterday!

I have a feeling this might be down to PHP 4.3.5RC3, as that's the only difference i can spot between this server and another which is fine.
 
Old 09-30-2008, 07:58 PM   #8
danedmo
LQ Newbie
 
Registered: Sep 2008
Posts: 2

Rep: Reputation: 0
I know this is an old thread, However I just got 2 new servers with Centos 5, and I am having this exact issue.

Did anyone ever find what was causing this issue? Or find a way to resolve it?

~Daniel Edmondson
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how do I rsync & cron to fetch -current weekly? chess Slackware 3 09-11-2005 10:07 AM
Cron.daily sends me a logrotate Kill usage message. pollardd Linux - General 1 09-02-2005 12:18 PM
cron.daily & logrotate cccc SUSE / openSUSE 1 07-08-2005 12:06 PM
cron weekly does not run jordanthompson Linux - Software 21 01-16-2005 09:52 AM
Weekly Cron problem sopiaz57 Linux - General 2 11-15-2004 11:46 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:55 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration