nginx开机启动脚本
#!/bin/sh
#nginx start stop restart reload
#by zkg 2019-08-13
#chkconfig: 2345 32 62
#description: nginx is http server
#system functions
[ -f /etc/init.d/functions ] && . /etc/init.d/functions
#Define variables
PIDFILE=/data/nginx/logs/nginx.pid
SRC_PWD=/data/nginx/sbin
RETVAL=0
#Define functions
Usage(){
echo "Usage:sh $0 {start|stop|restart|reload}"
exit 1
}
StartNginx(){
if [ ! -f $PIDFILE ];then
echo "nginx is NOT running..."
[ -x $SRC_PWD/nginx ]||exit 1
$SRC_PWD/nginx &>/dev/null
RETVAL=$?
if [ -f $PIDFILE ];then
action "nginx is started" /bin/true
else
action "nginx is started" /bin/false
fi
else
echo "nginx is running..."
fi
return $RETVAL
}
StopNginx(){
if [ ! -f $PIDFILE ];then
echo "nginx is not run,need not stop..."
action "nginx is stopped" /bin/false
else
[ -x $SRC_PWD/nginx ]||exit 1
$SRC_PWD/nginx -s stop &>/dev/null
RETVAL=$?
if [ ! -f $PIDFILE ];then
action "nginx is stopped" /bin/true
else
action "nginx is stopped" /bin/true
fi
fi
return $RETVAL
}
ReloadNginx(){
if [ -f $PIDFILE ];then
$SRC_PWD/nginx -s reload &>/dev/null
action "nginx is reloaded" /bin/true
else
echo "nginx is not run..."
action "nginx is reloaded" /bin/false
fi
}
case $1 in
start)
StartNginx
RETVAL=$?
;;
stop)
StopNginx
RETVAL=$?
;;
restart)
StopNginx
sleep 3
StartNginx
RETVAL=$?
;;
reload)
ReloadNginx
RETVAL=$?
;;
*)
Usage
esac
exit $RETVAL
- nginx开机启动脚本
- nginx开机自动启动脚本
- nginx开机自动启动脚本
- 制作CentOS中Nginx开机启动脚本
- CentOS 6.5 开机启动MySQL Apache Nginx脚本
- nginx启动脚本并且开机自起
- nginx 设置开机自动启动脚本
- nginx 开机启动脚本 可以使用systemctl enable service 添加开机启动
- RHEL6编译安装nginx、开机启动脚本
- RHEL6编译安装nginx、开机启动脚本、重新编译、安装配置naxsi waf防火墙
- Nginx开机启动脚本
- 编写一个nginx开机启动脚本
- nginx开机自动启动脚本
- nginx开机启动脚本
- 制作CentOS中Nginx开机启动脚本(转)
- linux开机自动启动脚本
- 【树莓派】Python脚本开机自动启动
- Nginx启动脚本
- CentOS下nginx启动脚本
- Windows下Nginx的启动、停止等命令&Nginx 配置多域名&windows下设置Nginx开机自动启动