Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
/etc/init.d/apache2 restart FAILURE!!!
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
gentoo_0x00
n00b
n00b


Joined: 10 Mar 2005
Posts: 21
Location: Portland, Oregon

PostPosted: Sat Mar 11, 2006 2:10 am    Post subject: /etc/init.d/apache2 restart FAILURE!!! Reply with quote

I have run a few versions of apache2 on gentoo and never had problem restarting like this...

Apache verison: 2.0.55-r1

Just about every other time I try to restart:

Code:

# /etc/init.d/apache2 restart
 * Stopping apache2 ...                                                               [ ok ]
 * Starting apache2 ...
httpd (pid 30896) already running 


Then I run:
Code:

# ps auwx | grep apache
root       434  0.0  0.0   1492   464 pts/0    S+   17:52   0:00 grep apache


It seems like apache is trying to start again before it has shutdown completely

Nothing unusual in the logs.

I saw the whole entropy thing. It didnt seem like my problem, but I installed rngd anyway just to troubleshoot. It didnt help.

The only thing I notice is the apache defunct in the process list.

Code:

# /etc/init.d/apache2 stop && ps auwx | grep apache && /etc/init.d/apache2 start
 * Stopping apache2 ...                                                                        [ ok ]
root       849  3.8  0.4  21168 10344 ?        Ss   17:56   0:00 /usr/sbin/apache2 -D DEFAULT_VHOST -D PHP5 -D SSL -d /usr/lib/apache2 -f /etc/apache2/httpd.conf -k start
apache     850  0.0  0.3  19532  7276 ?        S    17:56   0:00 /usr/sbin/apache2 -D DEFAULT_VHOST -D PHP5 -D SSL -d /usr/lib/apache2 -f /etc/apache2/httpd.conf -k start
apache     851  0.0  0.4 242460  8976 ?        S    17:56   0:00 /usr/sbin/apache2 -D DEFAULT_VHOST -D PHP5 -D SSL -d /usr/lib/apache2 -f /etc/apache2/httpd.conf -k start
apache     853  0.0  0.0      0     0 ?        Z    17:56   0:00 [apache2] <defunct>
root       945  0.0  0.0   1496   468 pts/0    S+   17:56   0:00 grep apache
 * Starting apache2 ...
httpd (pid 849) already running


Which results in apache not running at all.

Code:
                                                                                                     [ ok ]
# ps auwx | grep apache
root      1001  0.0  0.0   1496   468 pts/0    S+   17:56   0:00 grep apache


Then to get it started again I need to:
Code:

# /etc/init.d/apache2 stop
 * Stopping apache2 ...
httpd (no pid file) not running                                                                      [ ok ]


And finally...
Code:

# /etc/init.d/apache2 start
 * Starting apache2 ...                                                                              [ ok ]



Here is how I emerged...

Code:

# emerge -pv apache

These are the packages that I would merge, in order:

Calculating dependencies ...done!
[ebuild   R   ] net-www/apache-2.0.55-r1  +apache2 -debug +doc -ldap -mpm-leader -mpm-peruser -mpm-prefork -mpm-threadpool -mpm-worker -no-suexec (-selinux) +ssl -static-modules +threads 0 kB


I suppose I could always stop apache wait a few seconds then start, becuase it has no trouble doing that... but how sad.

I would be grateful for any advice.
_________________
What if there was no such thing as hypothetical questions?


Last edited by gentoo_0x00 on Sat Mar 11, 2006 6:07 am; edited 1 time in total
Back to top
View user's profile Send private message
brims
Guru
Guru


Joined: 19 Apr 2004
Posts: 492
Location: Arizona

PostPosted: Sat Mar 11, 2006 5:38 am    Post subject: Reply with quote

Try /etc/init.d/apache2 zap then /etc/init.d/apache2 start
_________________
Adopt an Unanswered Post
Report violations, duplicates, misplaced, etc
Back to top
View user's profile Send private message
gentoo_0x00
n00b
n00b


Joined: 10 Mar 2005
Posts: 21
Location: Portland, Oregon

PostPosted: Sat Mar 11, 2006 6:08 am    Post subject: Reply with quote

Thanks for the tip, but it doesn't really solve the long term problem. Apache simply will not restart on its own.
_________________
What if there was no such thing as hypothetical questions?
Back to top
View user's profile Send private message
brims
Guru
Guru


Joined: 19 Apr 2004
Posts: 492
Location: Arizona

PostPosted: Sat Mar 11, 2006 7:21 am    Post subject: Reply with quote

You could edit the init script and put the zap command in for restart and start so you won't have to do that manually. It seems that when apache is stopped, it fails to remove the pid file, it could be a bug, but I don't really know.
_________________
Adopt an Unanswered Post
Report violations, duplicates, misplaced, etc
Back to top
View user's profile Send private message
gentoo_0x00
n00b
n00b


Joined: 10 Mar 2005
Posts: 21
Location: Portland, Oregon

PostPosted: Mon Mar 13, 2006 8:09 pm    Post subject: Reply with quote

Yeah no need to use zap as the init scripts already take care of it. Restarting apache again resets apache to the proper state.

Looks like it might be a bug. If I use apachectl it works perfectly.
_________________
What if there was no such thing as hypothetical questions?
Back to top
View user's profile Send private message
minskpower
Tux's lil' helper
Tux's lil' helper


Joined: 16 Jun 2005
Posts: 94
Location: /dev/null

PostPosted: Tue Mar 14, 2006 2:27 am    Post subject: Reply with quote

I've had the same problem since June last year. Not so annoying since I restart apache once in a blue moon :)
Other than that it's just fine.
Let us know if you find what's causing it.
Back to top
View user's profile Send private message
gentoo_0x00
n00b
n00b


Joined: 10 Mar 2005
Posts: 21
Location: Portland, Oregon

PostPosted: Tue Mar 14, 2006 11:01 pm    Post subject: Reply with quote

ok still not sure exactly why this a problem, but I have a solution.

I added this to the bottom of /etc/init.d/apache2
Code:

restart() {
         stop && sleep 2 && start || return 1
}


and all is fine.

Note: /etc/init.d/apache2 restart vs. /etc/init.d/apache2 reload

You should only use reload... The only reason I have ever needed restart is when I added a new SSL vhost.

"reload" is really graceful restart.
_________________
What if there was no such thing as hypothetical questions?
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum