首页 > 其他 > 详细

简单的nginx启动脚本

时间:2016-03-08 13:38:24      阅读:192      评论:0      收藏:0      [点我收藏+]

初学时写的一个简单nginx启动脚本,使用定义函数和传参的方法。(生产环境中是不能用pkill来杀服务的,要使用-s reload来平滑重启)

[sa@nginx-04]# cat start_nginx04.sh

#!/bin/sh

./etc/init.d/functions

start_nginx=/nginx/sbin/nginx

USAGE(){

   echo "USAGE $0{start|stop|restart}"

   exit 1

}

if [ $# -ne 1 ]

   then

   USAGE

fi

if [ "$1"== "start" ]

   then

   $start_nginx

   action "start nginx" /bin/true

elif ["$1" == "stop" ]

   then

   pkill nginx

   action "stop nginx" /bin/true

elif ["$1" == "restart" ]

   then

   pkill nginx

   sleep 2

   $start_nginx

   action "restart nginx" /bin/true

else

   USAGE

fi


简单的nginx启动脚本

原文:http://hejianping.blog.51cto.com/11279690/1748701

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!