cat /etc/init.d/httpd

# cat /etc/init.d/httpd
#!/bin/bash
#
# httpd Startup script for the Apache HTTP Server
#
# chkconfig: - 85 15
# description: The Apache HTTP Server is an efficient and extensible \
# server implementing the current HTTP standards.
# processname: httpd
# config: /etc/httpd/conf/httpd.conf
# config: /etc/sysconfig/httpd
# pidfile: /var/run/httpd/httpd.pid
#
### BEGIN INIT INFO
# Provides: httpd
# Required-Start: $local_fs $remote_fs $network $named
# Required-Stop: $local_fs $remote_fs $network
# Should-Start: distcache
# Short-Description: start and stop Apache HTTP Server
# Description: The Apache HTTP Server is an extensible server
# implementing the current HTTP standards.
### END INIT INFO

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

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

# Start httpd in the C locale by default.
HTTPD_LANG=${HTTPD_LANG-"C"}

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

# Set HTTPD=/usr/sbin/httpd.worker in /etc/sysconfig/httpd to use a server
# with the thread-based "worker" MPM; BE WARNED that some modules may not
# work correctly with a thread-based MPM; notably PHP will refuse to start.

# Path to the apachectl script, server binary, and short-form for messages.
apachectl=/usr/sbin/apachectl
httpd=${HTTPD-/usr/sbin/httpd}
prog=httpd
pidfile=${PIDFILE-/var/run/httpd/httpd.pid}
lockfile=${LOCKFILE-/var/lock/subsys/httpd}
RETVAL=0
STOP_TIMEOUT=${STOP_TIMEOUT-10}

# 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: "
LANG=$HTTPD_LANG daemon --pidfile=${pidfile} $httpd $OPTIONS
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch ${lockfile}
return $RETVAL
}

# When stopping httpd, a delay (of default 10 second) is required
# before SIGKILLing the httpd parent; this gives enough time for the
# httpd parent to SIGKILL any errant children.
stop() {
echo -n $"Stopping $prog: "
killproc -p ${pidfile} -d ${STOP_TIMEOUT} $httpd
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile}
}
reload() {
echo -n $"Reloading $prog: "
if ! LANG=$HTTPD_LANG $httpd $OPTIONS -t >&/dev/null; then
RETVAL=6
echo $"not reloading due to configuration syntax error"
failure $"not reloading $httpd due to configuration syntax error"
else
# Force LSB behaviour from killproc
LSB=1 killproc -p ${pidfile} $httpd -HUP
RETVAL=$?
if [ $RETVAL -eq 7 ]; then
failure $"httpd shutdown"
fi
fi
echo
}

# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status -p ${pidfile} $httpd
RETVAL=$?
;;
restart)
stop
start
;;
condrestart|try-restart)
if status -p ${pidfile} $httpd >&/dev/null; then
stop
start
fi
;;
force-reload|reload)
reload
;;
graceful|help|configtest|fullstatus)
$apachectl [email protected]
RETVAL=$?
;;
*)
echo $"Usage: $prog {start|stop|restart|condrestart|try-restart|force-re
load|reload|status|fullstatus|graceful|help|configtest}"
RETVAL=2
esac

exit $RETVAL

时间: 2024-08-02 13:29:44

cat /etc/init.d/httpd的相关文章

haproxy部署及配置

HAProxy介绍 (1)HAProxy 是一款提供高可用性.负载均衡以及基于TCP(第四层)和HTTP(第七层)应用的代理软件,支持虚拟主机,它是免费.快速并且可靠的一种解决方案. HAProxy特别适用于那些负载特大的web站点,这些站点通常又需要会话保持或七层处理.HAProxy运行在时下的硬件上,完全可以支持数以万计的 并发连接.并且它的运行模式使得它可以很简单安全的整合进您当前的架构中, 同时可以保护你的web服务器不被暴露到网络上. (2)HAProxy 实现了一种事件驱动.单一进程

Shell脚本自动部署(编译)LAMP平台

Shell脚本自动部署(编译)LAMP平台 LAMP是当下非常流行的一套Web架构,我们可以在GNU/Linux下通过其他人打包的程序包来进行安装; 但是在生产环境中,很多时候都需要我们自己定制安装AMP,编译安装LAMP有以下几个优点 根据生产环境灵活定制程序 优化编译参数,提高性能 解决不必要的软件依赖 友情提示:对编译安装有疑问的朋友, 查看我以前写的博客:教你使用rpm.yum.编译等方式安装软件 点击此处获得更好的阅读体验 为什么要用脚本进行部署? 在很多情况下部署LAMP平台并不止一

apache2.2.31源码安装详细过程

本文是把apache安装在虚拟机中的详细过程,有需要的朋友可以参考下: 首先我们大体先分个步骤: 安装编译环境 卸载原有apache 下载源码包 安装apache 修改配置文件 测试apache 查看apache生成目录 把apache加入系统服务以及开机自启动 一.安装编译环境 在安装apache之前,我们需要安装编译apache时所需要的相关软件包: yum -y install gcc gcc++ zlib zlib-devel 二.卸载原有Apache rpm -qa |grep htt

LAMP源码安装,搭建zabbix监控

#LAMP#httpd-2.2.32#mysql-5.7.17-linux-glibc2.5-x86_64 二进制压缩版#php5.3.271.系统环境优化检查sed -i 's/SELINUX=enabled/SELINUX=disabled/g' /etc/selinux/configgetenforce 0/etc/init.d/iptables stopcat /etc/redhat-release CentOS release 6.7 (Final)uname -r2.6.32-431

源码安装LAMP环境+yii2框架

当有些新增的软件版本出现,而你想要进行尝试使用,但是在本地用yum安装却不能满足你的需求时, 那么朋友,你需要和我一样用源码安装的形式来达成你的目的. 因为开发的同事想要一个Apache 2.4.25 + Mysql 5.7.17 + php7.1.5 + yii2-basic的环境来做活动. 为了满足应用需求,现在我们就开始着手做吧! 一.安装Apache 本来在本地,只要你能联网,就能够用yum轻轻松松安装上Apache,而且安装的版本会比官网上 下载的最新源码包还要新. 但我发现yum安装

Shell 变量详解教程之位置变量与预定义变量。

Shell 变量分为3部分,分别是用户自定义变量.位置变量和预定义变量. 一.   自定义变量 那么,什么是变量呢?简单的说,就是让某一个特定字符串代表不固定的内容,用户定义的变量是最普通的Shell变量.y=3a+2b,就是把3a+2b这个值赋予y.变量名是以字母或下线符打头的,可以从第二位开始加入数字,并且大小写字母意义不同.如dir与Dir是不同的变量.变量名的长度不受限制.比如:expert=Bill,就是将Bill赋值给expert,后来脚本读取变量$expert时,会取值为Bill

Apache2.4.25编译安装之虚拟主机For Centos7

安装之前准备: 配置好防火墙,selinux,时区. 检查系统是否安装了httpd服务 yum install gcc gcc-c++ zlib-devel 下载软件,pcre,apr,apr-util,apache wget https://ftp.pcre.org/pub/pcre/pcre-8.40.tar.gz wget http://mirror.bit.edu.cn/apache//apr/apr-1.5.2.tar.gz wget http://mirror.bit.edu.cn/

烂泥:源码安装apache

本文由秀依林枫提供友情赞助,首发于烂泥行天下. 最近要开始学习nagios监控方面的知识了,但是nagios与apache结合的比较紧密,所以本篇文章就先把apache的源码安装学习下. 我们现在分以下步骤进行安装apache: 1. 安装编译环境 2. 卸载原有apache 3. 下载解压源码包 4. 安装apache 5. 测试apache 6. 查看apache安装生成的目录 7. 查看apache的配置文件 8. apache加入系统服务 一.安装编译环境 在安装apache之前,我们需

Linux下Apache源码安装经验

1. 从Apache官网下载自己所需要的版本.(这里以2.4版本为例)http://httpd.apache.org/download.cgi#apache24 (参考网址http://www.jb51.net/article/59474.htm 和 http://blog.csdn.net/yiluoak_47/article/details/22067185 ) 2. 把下载的源码包拷贝(用的WinSCP软件拷贝文件)到Liunx服务器上,进入到这个目录,然后解压 tar –zxvf htt