Current time: 11-22-2024, 03:07 PM Hello There, Guest! (LoginRegister)


Post Reply 
Apache just stopped :O!!
Author Message
nicolas Offline
Junior Member
*

Posts: 21
Joined: Aug 2008
Reputation: 1
Post: #11
RE: Apache just stopped :O!!
Hi,

I am still investigating the issue. I have been logging all operations during logrotate and still have not found why Apache is stopping and not starting again.

But I came through this file: /etc/logrotate.d/ispcp which contains:

Quote:/var/log/apache2/users/*.log {
weekly
missingok
rotate 52
compress
delaycompress
notifempty
create 640 root adm
sharedscripts
prerotate
/var/www/ispcp/engine/traffic/ispcp-vrl-traff > /var/log/ispcp/ispcp-vrl-traff.log
endscript
postrotate
for i in `seq 1 10`; do
if [ -f /var/run/apache2.pid ]; then
/etc/init.d/apache2 stop > /dev/null
sleep 5
/etc/init.d/apache2 start > /dev/null
fi
done
endscript
}

Is there a particular reason for stopping and starting Apache 10 times ?
09-10-2008 06:44 PM
Find all posts by this user Quote this message in a reply
sci2tech Away
Senior Member
****

Posts: 1,285
Joined: Jan 2007
Reputation: 23
Post: #12
RE: Apache just stopped :O!!
nicolas Wrote:Is there a particular reason for stopping and starting Apache 10 times ?
Thank you for signaling this. See r1348.
09-11-2008 06:18 AM
Visit this user's website Find all posts by this user Quote this message in a reply
nicolas Offline
Junior Member
*

Posts: 21
Joined: Aug 2008
Reputation: 1
Post: #13
RE: Apache just stopped :O!!
[/quote]I finally found where the error is! Apache is stopping when instructed in the /etc/logrotate.d/ispcp script, but does not start again, claiming that port 80 is already bound. Here is the error I logged:

Quote:Fri Sep 12 09:08:28 CEST 2008
* Stopping web server apache2
...done.
* Starting web server apache2
(98)Address already in use: make_sock: could not bind to address [::]:80
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs
...fail!
error: error running shared postrotate script for /var/log/apache2/users/*.log
(I have not logged the time when apache2 tries to start again... I will add it to my logs)

I understand that the part of the script that does:
Quote: for i in `seq 1 10`; do
if [ -f /var/run/apache2.pid ]; then
sleep 5
fi
is not working as it should. Is it possible that the apache2.pid file gets deleted when apache2 stops, but that some requests are still being served (thus leaving the port 80 bound)?

I will try to change the logrotate script from apache stop / start to "/etc/init.d/apache2 restart" and report results here (the /etc/init.d/apache2 restart script includes a 10second sleep and does a gracefull stop start).

Nicolas.
09-12-2008 08:15 PM
Find all posts by this user Quote this message in a reply
sci2tech Away
Senior Member
****

Posts: 1,285
Joined: Jan 2007
Reputation: 23
Post: #14
RE: Apache just stopped :O!!
apache does not need to be restarted anymore on logrotation if you are using ISPCP from trunk. Do not use restart because is an alias for stop... sleep 10 ... start. Better use apache reload. It did solve my problems. Do not know how apache reload is supported by other distro, thats why I did not modified to use this.
09-13-2008 12:32 AM
Visit this user's website Find all posts by this user Quote this message in a reply
nicolas Offline
Junior Member
*

Posts: 21
Joined: Aug 2008
Reputation: 1
Post: #15
RE: Apache just stopped :O!!
I am not keen on moving on a trunk release yet (I prefer to wait for the next stable release, to keep things easy to update).

Your solution seems to be exactly what I was looking for. I thought that "apache2 restart" was mandatory after a log rotation but it's not! Under Ubuntu the default script for logrotate.d/apache2 is:

Quote: postrotate
if [ -f "`. /etc/apache2/envvars ; echo ${APACHE_PID_FILE:-/var/run/apache2.pid}`" ]; then
/etc/init.d/apache2 reload > /dev/null
fi

So I guess this is what should be used (at least under Ubuntu).
09-13-2008 01:26 AM
Find all posts by this user Quote this message in a reply
nicolas Offline
Junior Member
*

Posts: 21
Joined: Aug 2008
Reputation: 1
Post: #16
RE: Apache just stopped :O!!
This is to confirm that my problem was solved by changing the "apache2 restart" command by a "apache2 reload" in /etc/logrotate.d/apache2 and ispcp files, as it is done by default on Ubuntu.

Best regards and thanks to sci2tech!
09-17-2008 07:32 PM
Find all posts by this user Quote this message in a reply
Wut Offline
Junior Member
*

Posts: 18
Joined: Aug 2007
Reputation: 0
Post: #17
RE: Apache just stopped :O!!
(09-17-2008 07:32 PM)nicolas Wrote:  This is to confirm that my problem was solved by changing the "apache2 restart" command by a "apache2 reload" in /etc/logrotate.d/apache2 and ispcp files, as it is done by default on Ubuntu.

Best regards and thanks to sci2tech!

Hi folks,

I found similar problem as nicolas.

I already change "apache2 restart" to "apache2 reload" in /etc/logrotate.d/apache2 but what I should do to /etc/logrotate.d/ispcp ?

My system is debian so nicolas's solution may not work for mine ?
(This post was last modified: 10-16-2008 05:35 PM by Wut.)
10-16-2008 05:26 PM
Find all posts by this user Quote this message in a reply
sci2tech Away
Senior Member
****

Posts: 1,285
Joined: Jan 2007
Reputation: 23
Post: #18
RE: Apache just stopped :O!!
(10-16-2008 05:26 PM)Wut Wrote:  Hi folks,
I found similar problem as nicolas.
I already change "apache2 restart" to "apache2 reload" in /etc/logrotate.d/apache2 but what I should do to /etc/logrotate.d/ispcp ?
Same thing. /etc/logrotate.d/apache2 Has nothing to do with ispcp because is not altered in any way by ispcp. In /etc/logrotate.d/ispcp I already did this modifications in the trunk and you should do the same with your installation. Also until ispcp will be stable (and after as well) you should always follow development to see if any modifications done in the trunk is necessary to be implemented in your version of ispcp.
(This post was last modified: 10-16-2008 09:00 PM by sci2tech.)
10-16-2008 08:59 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Wut Offline
Junior Member
*

Posts: 18
Joined: Aug 2007
Reputation: 0
Post: #19
RE: Apache just stopped :O!!
(10-16-2008 08:59 PM)sci2tech Wrote:  
(10-16-2008 05:26 PM)Wut Wrote:  Hi folks,
I found similar problem as nicolas.
I already change "apache2 restart" to "apache2 reload" in /etc/logrotate.d/apache2 but what I should do to /etc/logrotate.d/ispcp ?
Same thing. /etc/logrotate.d/apache2 Has nothing to do with ispcp because is not altered in any way by ispcp. In /etc/logrotate.d/ispcp I already did this modifications in the trunk and you should do the same with your installation. Also until ispcp will be stable (and after as well) you should always follow development to see if any modifications done in the trunk is necessary to be implemented in your version of ispcp.
But there is no "apache2 restart" to change to "apache2 reload" in /etc/logrotate.d/ispcp ?
10-17-2008 01:40 AM
Find all posts by this user Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)