logo   

配置在linux下apache自动启动的脚本_zwf

当手动编译安装apache服务器后一般不会开机自动运行,需要自己添加:
# cd /etc/init.d
# vi apache2
加上以下脚本
#!/bin/sh
# description: Apache auto start-stop script.
# chkconfig: - 85 15
APACHE_HOME=/usr/local/apache2
APACHE_OWNER=root
if [ ! -f "$APACHE_HOME/bin/apachectl" ]
then
echo "Apache startup: cannot start"
exit
fi
case "$1" in
'start')
su - $APACHE_OWNER -c "$APACHE_HOME/bin/apachectl start"
;;
'stop')
su - $APACHE_OWNER -c "$APACHE_HOME/bin/apachectl stop"
;;
'restart')
su - $APACHE_OWNER -c "$APACHE_HOME/bin/apachectl restart"
;;
esac
# chmod 755 apache
# chkconfig --add apache
# chkconfig --level 345 apache2 on
Ok,测试Apache
# service apache2 start
# service apache2 stop
# service apache2 restart
同时reboot OS试一下apache是否开机自动运行了。
Tags:
访问文章出处: http://hi.baidu.com/zhangwf/blog/item/556c86cb8d7d93f853664f05.html(配置在linux下apache自动启动的脚本_zwf)

上一篇: linux开机后apache不能自动启动 - 门的另一边 - PHPChina 开源社区门户 - Powered by X-Space
下一篇: linux重启命令_心飞扬|幽默搞笑|技术时空