增加 server httpd 控制脚本
来源:互联网 发布:品油邦淘宝店可靠吗 编辑:程序博客网 时间:2024/06/08 16:00
原版的脚本里 查看status 需要用 lynx这个命令,还要开启http://localhost:80/server-status
比较麻烦,我直接注释了,新加的代码用红色字体
#!/bin/sh
#chkconfig: 2345 50 90
#description: httpd is web server
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You 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`"
status1=$(ps -ef | egrep "/usr/local/apache/bin/httpd -k start" | grep -v 'grep')
#status
function httpd_status() {
if [ "${status1}X" != "X" ];then
echo "httpd service is running !"
else
echo "httpd service is not running !"
fi
}
# -------------------- --------------------
# |||||||||||||||||||| 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|graceful-stop)
$HTTPD -k $ARGV
ERROR=$?
;;
startssl|sslstart|start-SSL)
echo The startssl option is no longer supported.
echo Please edit httpd.conf to include the SSL configuration settings
echo and then use "apachectl start".
ERROR=2
;;
configtest)
$HTTPD -t
ERROR=$?
;;
status)
#$LYNX $STATUSURL | awk ' /process$/ { print; exit } { print } '
httpd_status
httpd_status
;;
fullstatus)
$LYNX $STATUSURL
;;
*)
$HTTPD $ARGV
ERROR=$?
esac
exit $ERROR
阅读全文
0 0
- 增加 server httpd 控制脚本
- Shell 增加server rsync 控制脚本
- Apache Web Server -> httpd 的文档根目录 及 访问控制
- [AHK]为某个脚本增加开关,控制其它脚本
- centos7 httpd如何增加虚拟目录
- HTTPD - Apache2 Web Server
- Apache httpd 2.4 访问控制
- Apache httpd Server模块开发
- Apache HTTP Server > httpd.conf
- 【MasterPages实用技巧】为模板增加前端控制②——自动注册客户端全局脚本
- 第6天-4 控制文件脚本】【增加redo log 镜像】【控制文件损坏下rman恢复】
- 控制脚本
- httpd系统自带启动脚本详解
- httpd系统自带启动脚本详解
- python脚本修改httpd.conf文件
- httpd-2.4.x 版本客户端访问控制
- httpd-2.4.x 版本客户端访问控制
- httpd-2.4.x 版本客户端访问控制
- linux 删除文件 磁盘空间未释放
- Python3 -- argparse模块
- PAT乙级题1004.成绩排名
- Linux简介
- Linux恢复删除的文件
- 增加 server httpd 控制脚本
- 内存对齐
- Firewall 防火墙
- Fastdfs php扩展访问
- 软链接 硬链接
- chatrr lsatrr
- inotify
- maven使用教程
- http-关于application/x-www-form-urlencoded等字符编码的解释说明