nginx 脚本启动检查
2016-07-06 22:46
447 查看
#!/bin/bash
# chkconfig: 2345 99 20
# description: nginx-server
nginx=/usr/local/nginx/sbin/nginx
case $1 in
start)
netstat -anlpt |grep nginx
if [ $? -eq 0 ]
then
echo "nginx-server is already running"
else
echo " nginx-server begin start"
$nginx
fi
;;
stop)
$nginx -s stop
if [ $? -eq 0 ]
then
echo "nginx-server is stoped"
else
echo "nginx-server stop fail,try again"
fi
;;
status)
netstat -anlpt |grep nginx
if [ $? -eq 0 ]
then
echo "nginx-server is runing "
else
echo "nginx-server is stopped"
fi
;;
restart)
$nginx -s reload
if [ $? -eq 0 ]
then
echo "nginx-server is begin restart"
else
echo "nginx-server restart fail"
fi
;;
*)
echo "place enter {start restart status stop}"
;;
esac
exit 0
# chkconfig: 2345 99 20
# description: nginx-server
nginx=/usr/local/nginx/sbin/nginx
case $1 in
start)
netstat -anlpt |grep nginx
if [ $? -eq 0 ]
then
echo "nginx-server is already running"
else
echo " nginx-server begin start"
$nginx
fi
;;
stop)
$nginx -s stop
if [ $? -eq 0 ]
then
echo "nginx-server is stoped"
else
echo "nginx-server stop fail,try again"
fi
;;
status)
netstat -anlpt |grep nginx
if [ $? -eq 0 ]
then
echo "nginx-server is runing "
else
echo "nginx-server is stopped"
fi
;;
restart)
$nginx -s reload
if [ $? -eq 0 ]
then
echo "nginx-server is begin restart"
else
echo "nginx-server restart fail"
fi
;;
*)
echo "place enter {start restart status stop}"
;;
esac
exit 0
相关文章推荐
- nginx代理指定目录
- 访问Nginx发生SSL connection error的一种情况
- Nginx+Naxsi部署专业级Web应用防火墙
- CentOS 6.2实战部署Nginx+MySQL+PHP
- nginx中http核心模块的配置指令2
- nginx中http核心模块的配置指令3
- nginx中http核心模块的配置指令4
- nginx中http的fastcgi模块的配置指令1
- Nginx 学习笔记(一)
- 网站502与504错误分析
- 用zabbix监控nginx_status状态
- 艰难完成 nginx + puma 部署 rails 4的详细记录
- 把Lua编译进nginx步骤方法
- web 应用中常用的各种 cache详解
- Linux系统上配置Nginx+Ruby on Rails+MySQL超攻略
- window+nginx+php环境配置 附配置搭配说明
- 解析CI即CodeIgniter框架在Nginx下的重写规则
- 将PHP从5.3.28升级到5.3.29时Nginx出现502错误
- 基于Nginx0.8.54+PHP5.3.4+MySQL5.5.8的全新LNMP稳定版架构搭建的VPS