RE: Suggestion for apachectl

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



You can certainly do something like what you propose in your apachectl, but you also probably want to avoid doing anything as clumsy as

        ps -ef | grep `cat /usr/apache/logs/httpd.pid` | grep -v grep > /dev/null 2>&1

Rather try something like
	kill -0 `cat /usr/apache/logs/httpd.pid`
	if [ $? ]; then ... fi
 
-ascs
 

________________________________

De : JAIN, ABHAY K, ATTSI [mailto:jainabhay@xxxxxxx] 
Envoyé : lundi 29 octobre 2007 19:02
À : users@xxxxxxxxxxxxxxxx
Objet :  Suggestion for apachectl


We have setup to gracefully shutdown/startup of Apache via init.d
on our UNIX systems. Recently we had a power outage in our lab.
It caused httpd.pid file to remain in logs directory and prevented
Apache to automatically restart upon power up.
We had to manually remove httpd.pid in each machine and start Apache.
 
I am proposing following change in start section of apachectl
to automate startup in such condition.
Please comment. How can this be incorporated in Apache.
 
case $ARGV in
start)
    if [ -r /usr/apache/logs/httpd.pid ]
    then
        # Check if apache is running
        ps -ef | grep `cat /usr/apache/logs/httpd.pid` | grep -v grep > /dev/null 2>&1
        if [ $? -ne 0 ]
        then
                # Probably system was not shutdown properly
                rm -f /usr/apache/logs/httpd.pid
        fi
    fi
    $HTTPD -k $ARGV
    ERROR=$?
    ;;
 
Abhay

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux