天天看點

service httpd restart(start、stop)的問題

終于可以了....  

[root@firewall init.d]# more httpd 

#!/bin/sh 

# Startup script for the Apache Web Server 

# chkconfig: 345 85 15 

# description: Apache is a World Wide Web server.  It is used to serve \ 

#              HTML files and CGI. 

# processname: httpd 

# pidfile: /var/run/httpd.pid 

# config: /etc/httpd/conf/access.conf 

# config: /etc/httpd/conf/httpd.conf 

# config: /etc/httpd/conf/srm.conf 

# Source function library. 

. /etc/rc.d/init.d/functions 

# See how we were called. 

case "$1" in 

  start) 

        echo -n "Starting httpd: " 

       *********************** 

       # daemon httpd 

        /usr/local/apache/bin/apachectl start 

        echo 

        touch /var/lock/subsys/httpd 

        ;; 

  stop) 

        echo -n "Shutting down http: " 

        killproc httpd 

        rm -f /var/lock/subsys/httpd 

        rm -f /var/run/httpd.pid 

  status) 

        status httpd 

  restart) 

        $0 stop 

        $0 start 

  reload) 

        echo -n "Reloading httpd: " 

        killproc httpd -HUP 

  *) 

        echo "Usage: $0 {start|stop|restart|reload|status}" 

        exit 1 

esac 

exit 0 

************************* 

在末修改前,改變程序狀态時提示資訊如下: 

[root@firewall init.d]# ./httpd stop 

Shutting down http: [  OK  ] 

[root@firewall init.d]# ./httpd start 

Starting httpd: execvp: No such file or directory 

[FAILED] 

root@firewall init.d]# chkconfig --level 35 httpd on  

service httpd does not support chkconfig  

之後: 

我參考了其它RH7.2系統上其它版本的apache的/etc/rc.d/init.d/httpd檔案, 

隻将 

    # daemon httpd             (将這行登出掉) 

        /usr/local/apache/bin/apachectl start          (換成這行) 

然後: 

[root@firewall init.d]# chkconfig --level 35 httpd on 

就可以了... 

請問daemon httpd             中的daemon代表什麼..,背景?

本文轉自 holy2009 51CTO部落格,原文連結:http://blog.51cto.com/holy2010/357175