LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 636|回复: 3

我用源码包安装apache,想修改、添加个httpd startup script,但没成功~~~

[复制链接]
发表于 2004-4-2 15:21:54 | 显示全部楼层 |阅读模式
从网上找到个本本,修改成下面这样
[PHP]#!/bin/bash
#
# Startup script for the Apache Web Server
#
# chkconfig: - 85 15
# description: Apache is a World Wide Web server.  It is used to serve \
#              HTML files and CGI.
# processname: httpd
# pidfile: /opt/apache/logs/httpd.pid
# config: /opt/apache/conf/httpd.conf

# Source function library.
. /etc/rc.d/init.d/functions

if [ -f /etc/sysconfig/httpd ]; then
        . /etc/sysconfig/httpd
fi

# This will prevent initlog from swallowing up a pass-phrase prompt if
# mod_ssl needs a pass-phrase from the user.
INITLOG_ARGS=""

# Path to the apachectl script, server binary, and short-form for messages.
apachectl=/opt/apache/bin/apachectl
httpd=/opt/apache/bin/httpd
pid=$httpd/logs/httpd.pid
prog=httpd
RETVAL=0


# The semantics of these two functions differ from the way apachectl does
# things -- attempting to start while running is a failure, and shutdown
# when not running is also a failure.  So we just do it the way init scripts
# are expected to behave here.
start() {
        echo -n $"Starting $prog: "
        daemon $httpd $OPTIONS
        RETVAL=$?
        echo
        [ $RETVAL = 0 ] && touch /var/lock/subsys/httpd
        return $RETVAL
}
stop() {
        echo -n $"Stopping $prog: "
        killproc $httpd
        RETVAL=$?
        echo
        [ $RETVAL = 0 ] && rm -f /var/lock/subsys/httpd $pid
}
reload() {
        echo -n $"Reloading $prog: "
        killproc $httpd -HUP
        RETVAL=$?
        echo
}

# See how we were called.
case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  status)
        status $httpd
        RETVAL=$?
        ;;
  restart)
        stop
        start
        ;;
  condrestart)
        if [ -f $pid ] ; then
                stop
                start
        fi
        ;;
  reload)
        reload
        ;;
  graceful|help|configtest|fullstatus)
        $apachectl $@
        RETVAL=$?
        ;;
  *)
        echo $"Usage: $prog {start|stop|restart|condrestart|reload|status"
                echo $"|fullstatus|graceful|help|configtest}"
        exit 1
esac

exit $RETVAL

[/PHP]
用chkconfig --add httd可以添加httpd服务,但运行它却不行,不知道缺了些什么。
我的apache的安装目录是/opt/apache
发表于 2004-4-2 15:38:38 | 显示全部楼层
service httpd start
发表于 2004-4-2 16:32:58 | 显示全部楼层
想启动时运行还要
chkconfig httpd off
chkconfig httpd --level2345 on
发表于 2004-4-2 16:35:07 | 显示全部楼层
最初由 waker 发表
想启动时运行还要
chkconfig httpd off
chkconfig httpd --level2345 on

chkconfig设置的服务就是为了下次启动设置的
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表