Free Downloads, Community Forum,
FAQs and Developer Resources


Make /Tools Your Home | Link to us

Today's posts | Posts since last visit | Most Active Topics

All Forums Register Login Search Subscriptions My Profile Inbox
Tool Warehouse FAQs Resources Help Member List Address Book Logout

Apache restart problem

 
Logged in as: Guest
Users viewing this topic: none
  Printable Version
All Forums >> [SFU / Interix / SUA Technology] >> Interix Advanced Forum >> Apache restart problem Page: [1]
Login
Message << Older Topic   Newer Topic >>
Apache restart problem - Oct. 13, '04, 7:29:12 AM   
eugene

 

Posts: 9
Joined: Mar. 17, '04,
Status: offline
Hello, all.

Sometimes (when power failure occurs) my apache shutdown unexpectedly. In this situation it leave file /usr/local/apache2/logs/httpd.pid with pid of instance. Duaring next start it see this file and not started. I fix this situation by forcing shutdown apache before start it. But this file created with this owner/mode
-rw-r--r-- 1 eugene +Administrators 4 Oct 11 11:07 httpd.pid
and solution work only if log into the same account. If any other admin login - file don`t deleted, apache don`t start.

My not so elegant solution to this problem was configure apache to use /usr/local/apache2/logs/nul file instead - due strange bug this file created and used as usual file, but its windows owner not set to its unix owner - and remain Administrators as show dir /Q
11.10.2004 11:07 5 XXXXXXXX\eugene httpd.pid
13.10.2004 14:18 5 BUILTIN\Administrators nul

This file can be deleted by apache when it started in any (Administrators?) account - that I need.

The question - how to solve this problem in right way ? :)
Post #: 1
RE: Apache restart problem - Oct. 13, '04, 11:13:43 AM   
Rodney

 

Posts: 2949
Joined: Jul. 9, '02,
From: /Tools lab
Status: offline
Do you have a UPS and the UPS software that goes with it?
If you do then you can schedule a shutdown at certain power levels.
With that shutdown you can script that certain processes get notified to
do stop/exit because of the shutdown.

The other is the "apachectl" script itself. It is a shell script so you can
modify it. Instead of the script setting up and checking a PID file. You
could change it to use ps and look for a live Apache. You could
do something like:
"ps -ai | grep apache | awk '{print $1}' | head -1"
instead. This would get you the parent apache PID.

(in reply to eugene)
Post #: 2
RE: Apache restart problem - Oct. 13, '04, 1:11:03 PM   
eugene

 

Posts: 9
Joined: Mar. 17, '04,
Status: offline
no UPS available. In other case Windows shutdown normally, and no additional bodymoves required - file deleted automatically, and don`t prevent apache from starting normally

Apache 2.0.48. Its apachectl script effectively call /usr/local/apache2/bin/httpd (PE file) with the same arguments. I change in apachectl this lines

case $ARGV in
start|stop|restart|graceful)
$HTTPD -k $ARGV
;;

to this

case $ARGV in
start)
$HTTPD -k stop
$HTTPD -k start
;;
stop|restart|graceful)
$HTTPD -k $ARGV
;;

This force apache to delete file - but described in previous post problem with rights occur.

Hmm. I think, after apache start I may add remove permission on pid file to everyone, and delete it before apache start, something like that:

$LOG = '/usr/local/apache2/logs/httpd.pid'
case $ARGV in
start)
rm -f $LOG
$HTTPD -k start
chmod a+w $LOG
;;

the problem is that chmod must execute AFTER httpd started and create this pid file. Is there way to wait for file creation?

(in reply to Rodney)
Post #: 3
Page:   [1]
All Forums >> [SFU / Interix / SUA Technology] >> Interix Advanced Forum >> Apache restart problem Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts


Search All Forums -

Advanced search


SPONSORS



Forum Software © ASPPlayground.NET Advanced Edition 2.5 ANSI

0.031