免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1038 | 回复: 2
打印 上一主题 下一主题

service问题 [复制链接]

论坛徽章:
1
IT运维版块每日发帖之星
日期:2015-09-29 06:20:00
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2006-11-24 15:34 |只看该作者 |倒序浏览
设置apache自启动(redhat9)
安装好apache后设置自启动
root # cp support/apachectl /etc/init.d/httpd
# cat /etc/init.d/httpd
#!/bin/sh
#
# 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 CGL
# processname: httpd
# pidfile: /usr/local/appache/log/httpd.pid
# config: /usr/local/apache/conf/httpd.conf

# chkconfig -add httpd
# chmod 755 /etc/init.d/httpd
# chkconfig httpd on

# Copyright 2000-2005 The Apache Software Foundation or its licensors, as
# applicable.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
# Apache control script designed to allow an easy command line interface
# to controlling Apache.  Written by Marc Slemko, 1997/08/23
#
# The exit codes returned are:
#   XXX this doc is no longer correct now that the interesting
#   XXX functions are handled by httpd
#       0 - operation completed successfully
#       1 -
#       2 - usage error
#       3 - httpd could not be started
#       4 - httpd could not be stopped
#       5 - httpd could not be started during a restart
#       6 - httpd could not be restarted during a restart
#       7 - httpd could not be restarted during a graceful restart
#       8 - configuration syntax error
#
# When multiple arguments are given, only the error from the _last_
# one is reported.  Run "apachectl help" for usage info
#
ARGV="$@"
#
# |||||||||||||||||||| START CONFIGURATION SECTION  ||||||||||||||||||||
# --------------------                              --------------------
#
# the path to your httpd binary, including options if necessary
HTTPD='/usr/local/apache/bin/httpd'
#
# pick up any necessary environment variables
if test -f /usr/local/apache/bin/envvars; then
  . /usr/local/apache/bin/envvars
fi
#
# a command that outputs a formatted text version of the HTML at the
# url given on the command line.  Designed for lynx, however other
# programs may work.  
LYNX="lynx -dump"
#
# the URL to your server's mod_status status page.  If you do not
# have one, then status and fullstatus will not work.
STATUSURL="http://localhost:80/server-status"
#
# Set this variable to a command that increases the maximum
# number of file descriptors allowed per child process. This is
# critical for configurations that use many file descriptors,
# such as mass vhosting, or a multithreaded server.
ULIMIT_MAX_FILES="ulimit -S -n `ulimit -H -n`"
# --------------------                              --------------------
# ||||||||||||||||||||   END CONFIGURATION SECTION  ||||||||||||||||||||

# Set the maximum number of file descriptors allowed per child process.
if [ "x$ULIMIT_MAX_FILES" != "x" ] ; then
    $ULIMIT_MAX_FILES
fi

ERROR=0
if [ "x$ARGV" = "x" ] ; then
    ARGV="-h"
fi

case $ARGV in
start|stop|restart|graceful)
    $HTTPD -k $ARGV
    ERROR=$?
    ;;
startssl|sslstart|start-SSL)
    $HTTPD -k start -DSSL
    ERROR=$?
    ;;
configtest)
    $HTTPD -t
    ERROR=$?
    ;;
status)
    $LYNX $STATUSURL | awk ' /process$/ { print; exit } { print } '
    ;;
fullstatus)
    $LYNX $STATUSURL
    ;;
*)
    $HTTPD $ARGV
    ERROR=$?
esac

exit $ERROR

然后创建网页根目录等就不写了
启动apache
用命令:/usr/local/apache/bin/apchectl start
成功
用命令:service httpd start
root]# service httpd start
httpd: unrecognized service
怎么搞的,我还漏到什么步骤了?

论坛徽章:
0
2 [报告]
发表于 2006-11-26 03:29 |只看该作者
还需要完成以下两步:
1、chmod  +x /etc/init.d/httpd
2、chkconfig --add httpd

论坛徽章:
1
IT运维版块每日发帖之星
日期:2015-09-29 06:20:00
3 [报告]
发表于 2006-11-27 14:43 |只看该作者
谢谢
问题解决了
是我少加了一个-号
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP