shell脚本   http源码启动脚本

源码包http启动脚本,仅供参考......下面有文本的。

#!/bin/bash

#Author: wangergui              Email:[email protected]         Date:2016-06-01

#Function: source apache start script

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root:/bin

export PATH

[ -f /etc/rc.d/init.d/functions ] && . /etc/rc.d/init.d/functions || exit 2

APACHE=/usr/local/apache2/bin/apachectl

PIDFILE=/usr/local/apache2/logs/httpd.pid

CODE=$(curl -I -s http://localhost |awk ‘NR==1 {print $2}‘)

function mystart () {

if [ ${CODE} -eq 200 -a -f ${PIDFILE} ];then

echo " httpd is aready running!"

else

rm -rf ${PIDFILE} && ${APACHE} && [ $? -eq 0 ] && echo "httpd start sucellfully!" || exit 3

fi

}

function mystop () {

wget -q http://localhost >/dev/null 2>&1

if [ $? -eq 0 -a -f ${PIDFILE} ];then

killall -9 httpd

[ $? -eq 0 ] && echo "httpd stop ok"

else

rm -rf ${PIDFILE} && echo "httpd stop failed!"

fi

}

function myrestart () {

mystart

sleep 2

mystop

}

function myreload () {

wget -q http://localhost >/dev/null 2>&1

[ $? -eq 0 -f ${PIDFILE} ] && killall -s HUP ${APACHE} || exit 4

[ $? -ne 0 ] && echo "httpd service is not starting!"

}

function mystatus () {

wget -q http://localhost >/dev/null 2>&1

[ $? -eq 0 -a -f ${PIDFILE} ] && echo "httpd is running" || echo "httpd stop"

}

case $1 in

"start")

mystart

;;

"stop")

mystop

;;

"restart")

myrestart

;;

"reload")

myreload

;;

"status")

mystatus

;;

"*")

echo $"Usage: $0 {start|stop|restart|reload|status|}"

exit 8

;;

esac

时间: 2024-08-08 13:57:58

shell脚本   http源码启动脚本的相关文章

lnmp源码安装-脚本执行

lnmp 源码安装- 脚本执行 源码包版本: nginx1.9 mysql5.6.4 php5.6 使用: 将lnmp.tar.gz 解压至 根目录下,进入/lnmp/install/目录下,执行install.sh脚本即可.选择性安装! 安装过程中会有些警告信息显示,不影响. 整合包地址:http://pan.baidu.com/s/1dFp7gqP =======================代码============================= #!/bin/bash #####

shell脚本:lnmp等源码安装脚本

##脚本功能: # 源码安装dns.nginx.php.memcached.gonet.mysql,并做相关的配置 # ##脚本说明: # ##更新记录: # 1.增加dns.nginx的配置文件 # 2.优化mysql.nginx.dns等安装的部分函数 # 3.增加安装gonet服务的功能函数 -------------------------- #!/bin/bash # by colin on 2016-01-06 # revision on 2016-04-29 ###########

shell脚本实现源码lamp自动化安装

代码如下,写了好久,在centos6.3实践中用过,分享给大家@.·[email protected] 运行此脚本的前提有gcc/gcc-c++的编译环境,此脚本用到一些源码包(apr-1.2.7,apr-util-1.2.7,autoconf-2.59,cmake-2.6.4,curl-7.15.1,freetds-2.2.2,gd-2.0.33,httpd-2.2.31,jpegsrc-v7,libmcrypt-2.5.7,libpng-1.2.10,libxml2-2.6.26,mysql

spark源码阅读-脚本篇

spark都进化到2.0了,虽然之前对spark有所了解但总感觉似懂非懂的,所以想花时间看看源码. 面对大量的源码从哪里着手呢,想到老子的一句话“天下难事必作于易,天下大事必作于细”,所以就从脚本部分来啃. 因本人脚本编程能力也并不是那么强,所以在总结的时候会穿插一些shell的东西.此处只介绍shell脚本,不涉及bat脚本. 先按照首字母顺序介绍下每个脚本的功能: spark-1.5.0/bin beeline:基于SQLLine CLI的JDBC客户端,可以连接到hive,操作hive中的

linux shell 之尝试编写 企业级 启动脚本

企业Shell面试题10:开发企业级MySQL启动脚本 说明: MySQL启动命令为: 1 /bin/sh mysqld_safe --pid-file=$mysqld_pid_file_path 2>&1 >/dev/null & 停止命令逻辑脚本为: 1 2 3 4 5 6 mysqld_pid=`cat "$mysqld_pid_file_path"` if (kill -0 $mysqld_pid 2>/dev/null)   then    

通过Shell开发企业级标准服务启动脚本案例(MySQL)

老男孩教育Linux高端运维班Shell课后必会考试题: 企业Shell面试题10:开发企业级MySQL启动脚本 说明: MySQL启动命令为: /bin/sh mysqld_safe --pid-file=$mysqld_pid_file_path 2>&1 >/dev/null & 停止命令逻辑脚本为: mysqld_pid=`cat "$mysqld_pid_file_path"` if (kill -0 $mysqld_pid 2>/dev/n

LNMP-zabbix 监控源码安装脚本

#关闭iptables service iptables stop chkconfig iptablse off #关闭selinux setenforce 0 sed -i.bak '/^SELINUX=/ s#.*#SELINUX=disabled#' /etc/selinux/config yum install -y gcc gcc-c++ autoconf automake zlib zlib-devel openssl openssl-devel pcre* make gd-deve

LAMP一键源码安装脚本最新版(实测有效)

此脚本根据网上的进行了大量的修改,在RHEL5上做了实际测试,本人亲测有效. 运行次脚本有2个注意点: 1.在根目录下新建work目录,将光盘没有的rpm包放入其中,如果没有联网,将需要的rpm包也放入其中 2.将apache的服务启动脚本httpd,放入work目录 具体的httpd内容参见之前的博客,一步一步搭建LAMP. #!/bin/sh #Copyright(c) 2010-2015 jwh5566 ([email protected]) #install LAMP  #Version

02.利用Shell开发Redis多实例启动脚本

一.Redis部署情况 ## 软件部署情况 [[email protected] ~]# ls -ld /data/apps/redis <==目录本身及以下所有文件的属主/组为redis lrwxrwxrwx 1 root root 24 Oct 26 11:33 /data/apps/redis -> /data/apps/redis-4.0.14/ ## 实例部署情况 [[email protected] ~]# tree /data/redis/ <==目录本身及以下所有文件的属