#!/bin/bash # chkconfig: - 85 15 NGINX="/usr/local/nginx/sbin/nginx" PROG=$(basename $NGINX) LOCKFILE="/usr/local/nginx/nginx.lock" PIDFILE="/usr/local/nginx/nginx.pid" CONF="/usr/local/nginx/conf/nginx.conf" case "$1" in start) if [ -f $$PIDFILE ] then echo "$PIDFILE exists, process is already running or crashed." else echo "Starting $PROG..." $NGINX -c $CONF [ $? -eq 0 ] && touch ${LOCKFILE} sleep 4 && touch ${PIDFILE} echo "Done" fi ;; stop) if [ ! -f $PIDFILE ] then echo "$PIDFILE does not exist, process is not running." else echo "Stopping $PROG..." killall -s QUIT $PROG [ $? -eq 0 ] && rm -f ${LOCKFILE} ${PIDFILE} sleep 1 echo "Done" fi ;; status) if [ ! -f $PIDFILE ] then echo "Nginx is not running now!" else echo "Nginx is running now!" fi ;; restart) $0 stop $0 start ;; reload) echo "Reloading $PROG..." killall -s HUP $PROG ;; *) echo "Usage: $0 {start|stop|status|restart|reload}" exit 2 ;; esac
nginx重启脚本
原创yumgirl2049 ©著作权
©著作权归作者所有:来自51CTO博客作者yumgirl2049的原创作品,如需转载,请与作者联系,否则将追究法律责任
下一篇:mysql 重置root密码
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
nginx.conf文件配置及nginx重启脚本
#user nobody;worker_processes 8; //启动进程
nginx nginx.conf配置 nginx脚本 nginx重启 nginx配置 -
windows nginx重启脚本.batnginx 修改文件 txt文件 重启 .net