收藏文章 楼主

shell nginx 启动脚本

版块:shell   类型:普通   作者:小绿叶技术博客   查看:1038   回复:1   获赞:0   时间:2020-09-22 17:02:54

#!/bin/bash

# chkconfig: - 85 15

# description: nginx is a World Wide Web server. It is used to serve

:<<!

启动: /usr/local/nginx/sbin/nginx

停止: /usr/local/nginx/sbin/nginx -s stop

热加载: /usr/local/nginx/sbin/nginx -s reload

测试语法:/usr/local/nginx/sbin/nginx -t

!

program=/usr/local/nginx/sbin/nginx

pid=/usr/local/nginx/logs/nginx.pid

start(){

if [ -f $pid ];then

echo "nginx running"

else

$program

fi

}

stop(){

if [ ! -f $pid ];then

echo "nginx stop"

else

$program -s stop

echo "nginx stop"

fi

}

reload(){

$program -s reload

echo "nginx reloading complete"

}

status(){

if [ -f $pid ];then

echo "nginx running"

else

echo "nginx stop"

fi

}

case $1 in # $1  是执行脚本,跟上的第一个参数

start)

start;;

stop)

stop;;

reload)

reload;;

status)

status;;

*) # 没有匹配到参数,就匹配其他所有情况就打印

echo "您的输入有误,请重新输入参数 如 ./1.sh start"

esac

提供企业建站服务,免费网防系统,提交信息登录 http://yundun.ddoss.cn 邮箱: proposal@ddoss.cn 
回复列表
默认   热门   正序   倒序

回复:shell nginx 启动脚本

头像

用户名:

粉丝数:

签名:

资料 关注 好友 消息