加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 运营中心 > Nginx > 正文

nginx启动脚本

发布时间:2020-12-13 21:42:24 所属栏目:Nginx 来源:网络整理
导读:pre class="shell" #!/bin/bash nginx Start nginx chkconfig: - 85 15 description: The nginx is an efficient web server processname: nginx config: /usr/local/nginx/conf/nginx.conf pidfile: /usr/local/nginx/logs/nginx.pid #####################

<pre class="shell">#!/bin/bash

nginx Start nginx

chkconfig: - 85 15

description: The nginx is an efficient web server

processname: nginx

config: /usr/local/nginx/conf/nginx.conf

pidfile: /usr/local/nginx/logs/nginx.pid

##################################################

source function library.

. /etc/init.d/functions

RETVAL=0

base path

prog="nginx"
binfile="/usr/local/nginx/sbin/nginx"
pidfile="/usr/local/nginx/logs/nginx.pid"
confile="/usr/local/nginx/conf/nginx.conf"
lockfile="/usr/local/nginx/logs/nginx.lock"

if [ ! -x $bindir ];then
echo -n "$bindir not installed! "

Tell the user this has skipped

exit 5

fi

start(){
test -e $pidfile && echo $"Already Starting $prog" && exit 6
echo -n $"Starting $prog:"
daemon $binfile -c $confile
RETVAL=$?
[ $RETVAL -eq 0 ] && touch $lockfile
echo
}

stop(){
echo -n $"Stopping $prog:"
killproc -p $pidfile $prog
RETVAL=$?
[ $RETVAL -eq 0 ] && rm -f $lockfile $pidfile
echo
}

case "$1" in
start)
start
RETVAL=$?
;;
stop)
stop
RETVAL=$?
;;
restart)
stop
sleep 2
start
RETVAL=$?
;;
reload)
$binfile -s reload
;;
status)
status $binfile
;;
version)
$binfile -v
;;
configtest)
$binfile -t
;;
*)
echo $"Usage: $0 {start|stop|reload|restart|status|version|configtest}"
exit 2
;;
esac
exit $RETVAL

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读