Centos 下Nginx 自启动脚本
#!/bin/bash
#ckconfig:
NGINX_PATH=/web/container/nginx-1.2.
NGINX_COMMAND=$NGINX_PATH/sbin/nginx
NGINX_PID=$NGINX_PATH/logs/nginx.pid
VERSION=1.2.
CONF=$ start()
{
if [ -f $NGINX_PID ];
then
echo "[Failure] Nginx is starting"
else
echo "[Success] Starting Nginx $VERSION"
#用户设置好后统一使用同一个用户操作
#/bin/su - nginx -c "$NGINX_PATH/nginx $CONF 1>/dev/null 2>/dev/null"
$NGINX_COMMAND $CONF >/dev/null >/dev/null
fi
} stop()
{
echo $NGINX_PID
if [ -f $NGINX_PID ];
then
echo "[Success] Stopping Nginx $VERSION"
$NGINX_COMMAND -s quit
#/bin/kill -QUIT $(eval "/bin/cat $NGINX_PID")
else
echo "[Failure] Stop Failure. Nginx isn't starting "
fi
} reload()
{
if test -f $NGINX_PID;
then
echo "[Success] Reloading Nginx $VERSION"
$NGINX_COMMAND -s reload
else
echo "[Failure] Reload Failure. Nginx isn't starting "
fi
} out()
{
if test -f $NGINX_PID;
then
echo "[Success] Exiting Nginx $VERSION"
$NGINX_COMMAND -s stop
#/bin/kill - $(eval "/bin/cat $NGINX_PID")
else
echo "[Failure] Exiting Failure . Nginx isn't starting "
fi
} case "$1" in
start)
start
;;
stop)
stop ;;
restart) stop
sleep
start
;;
exit)
out
;;
reload)
reload
;;
*)
echo $"Usage: $0 {start|stop|restart|exit|reload}"
exit
;;
esac
exit
#!/bin/bash
# nginx Startup script for the Nginx HTTP Server
# it is v.0.0. version.
# chkconfig: -
# description: Nginx is a high-performance web and proxy server.
# It has a lot of features, but it's not for everyone.
# processname: nginx
# pidfile: /var/run/nginx.pid
# config: /usr/local/nginx/conf/nginx.conf
nginxd=/usr/local/nginx/sbin/nginx
nginx_config=/usr/local/nginx/conf/nginx.conf
nginx_pid=/usr/local/nginx/logs/nginx.pid
RETVAL=
prog="nginx"
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ {$NETWORKING} = "no" ] && exit
[ -x $nginxd ] || exit
# Start nginx daemons functions.
start() {
if [ -e $nginx_pid ];then
echo "nginx already running...."
exit
fi
echo -n $"Starting $prog: "
daemon $nginxd -c ${nginx_config}
RETVAL=$?
echo
[ $RETVAL = ] && touch /var/lock/subsys/nginx
return $RETVAL
}
# Stop nginx daemons functions.
stop() {
echo -n $"Stopping $prog: "
killproc $nginxd
RETVAL=$?
echo
[ $RETVAL = ] && rm -f /var/lock/subsys/nginx /usr/local/nginx/logs/nginx.pid
}
reload() {
echo -n $"Reloading $prog: "
#kill -HUP `cat ${nginx_pid}`
killproc $nginxd -HUP
RETVAL=$?
echo
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
reload)
reload
;;
restart)
stop
start
;;
status)
status $prog
RETVAL=$?
;;
*)
echo $"Usage: $prog {start|stop|restart|reload|status|help}"
exit
esac
exit $RETVAL
Centos 下Nginx 自启动脚本的更多相关文章
- centos下nginx启动脚本和chkconfig管理
在安装完nginx后,重新启动需要“kill -HUP nginx进程编号”来进行重新加载,显然十分不方便.如果能像apache一样,直接通过脚本进行管理就方便多了. nginx官方早就想好了,也提供 ...
- nginx 自启动脚本
nginx 自启动脚本 创建脚本 cd /etc/init.d vi nginx 脚本如下: #! /bin/bash # chkconfig: 35 85 15 # description: Ngi ...
- Nginx - Windows下Nginx初入门,附CentOS下Nginx的安装
公司刚使用nginx,预先学习下.鉴于机器没有Linux环境,在Windows熟悉下. 下载 目前(2015-07-11),nginx的稳定版本是1.8.0,在官网下载先,windows版的nginx ...
- Linux下nginx自启动配置
1.在linux系统的/etc/init.d/目录下创建nginx文件 vim /etc/init.d/nginx 在脚本中添加一下命令(内容主要参考官方文档) #!/bin/sh # # nginx ...
- 话说Centos下nginx,php,mysql以及phpmyadmin的配置
大话centos下部署phalcon框架 Centos还是ubuntu? 当我沿用这个标题的时候,心里在想"我能说我之前用的windows吗?",windows下xampp,wam ...
- Centos下 Nginx安装与配置
网上找了好多资料.都很难找全,这里以这个目录为主,进行备注. Nginx是一款轻量级的网页服务器.反向代理服务器.相较于Apache.lighttpd具有占有内存少,稳定性高等优势.它最常的用途是提供 ...
- CentOS下nginx php mysql 环境搭建
CentOS下搭建PHP运行环境. 首先是在虚拟机上装好一个命令行的CentOS,如果只是弄服务器的话,不要装图形界面,会比较卡. 一.安装编译工具及库文件 yum -y install make z ...
- CentOS下编写shell脚本来监控MySQL主从复制的教程
这篇文章主要介绍了在CentOS系统下编写shell脚本来监控主从复制的教程,文中举了两个发现故障后再次执行复制命令的例子,需要的朋友可以参考下 目的:定时监控MySQL主从数据库是否同步,如果不同步 ...
- 腾讯云Centos下Nginx反向代理Apache+Tomcat
1. 安装Apahce, PHP, MySQL以及php连接mysql库的组件#yum -y install httpd php mysql mysql-server php-mysql // ...
随机推荐
- Django设置
运行 django-admin.py startproject [project-name] 命令会生成一系列文件,在Django 1.6版本以后的 settings.py 文件中有以下语句: # B ...
- NET Reflector 8 使用
一,把杀毒软件停掉 二,把原机器上的 Reflector 文件删除 三,找到C:\Users\Administrator\AppData\Local\Red Gate这个目录,将里面的东西删除 四,v ...
- IBM MQ
一,安装 1,先安装必备MQ\MQ60\Prereqs\IES\Setup.exe 2,再安装MQ\MQParms.exe 二,发送方 刚装好后,默认有一个管理器名,可以删除,自己重新建,以防有不可知 ...
- C# list 筛选FindAll
例如:参数a.list b.ModelId:根据ModelId参数进行筛选 /// <summary> /// 根据ModelId筛选查询出对应的数据 /// </summary&g ...
- Xcode常用设置
1.设置主题和字体大小 2.设置显示代码行号
- 判断js中的数据类型
如何判断js中的数据类型:typeof.instanceof. constructor. prototype方法比较 如何判断js中的类型呢,先举几个例子: var a = "iamstri ...
- Mapped Statements collection does not contain value for ResearcherMapper.方法名
搞了半天, 原来是映射文件没加, 新手常遇到的问题. Mapped Statements collection does not contain value for后面是什么类什么方法之类的: 错误原 ...
- Xcode 向6.0以后版本添加iOS开发空白模板
打开finder,找到应用程序,找到xcode 右键显示包内容.按照如下目录进行查找:Contents ▸ Developer ▸ Platforms ▸ iPhoneOS.platform ▸ De ...
- Pig安装及简单使用(pig版本0.13.0,Hadoop版本2.5.0)
原文地址:http://www.linuxidc.com/Linux/2014-03/99055.htm 我们用MapReduce进行数据分析.当业务比较复杂的时候,使用MapReduce将会是一个很 ...
- PowerDesigner(五)-概念数据模型(CDM生成LDM,PDM和OOM)
概念数据模型 概念数据模型(Conceptual Data Model,CDM):表达的是数据整体逻辑结构,该结构独立于任何软件和数据存储结构,即它只是系统分析人员,应用程序设计人员,维护人员和用户之 ...