日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > linux >内容正文

linux

nginx在linux自动启动脚本,nginx的自动启动脚本

發布時間:2023/12/15 linux 23 豆豆
生活随笔 收集整理的這篇文章主要介紹了 nginx在linux自动启动脚本,nginx的自动启动脚本 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

忘了從哪個網址找到的了,請原作者見諒。該腳本在RedHat/CentOS下測試通過。

1、編輯/etc/init.d/ngxin,內容為:

#!/bin/bash

# v.0.0.1

# create by jackbillow at 2007.10.15

# nginx - This shell script takes care of starting and stopping nginx.

#

# chkconfig: - 60 50

# description: nginx [engine x] is light http web/proxy server

# that answers incoming ftp service requests.

# processname: nginx

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

nginx_path="/usr/local/nginx"

nginx_pid="/usr/local/nginx/nginx.pid"

# Source function library.

. /etc/rc.d/init.d/functions

# Source networking configuration.

. /etc/sysconfig/network

# Check that networking is up.

[ ${NETWORKING} = "no" ] && exit 0

[ -x $nginx_path/sbin/nginx ] || exit 0

RETVAL=0

prog="nginx"

start() {

# Start daemons.

if [ -e $nginx_pid -a ! -z $nginx_pid ];then

echo "nginx already running...."

exit 1

fi

if [ -e /usr/local/nginx/conf/nginx.conf ];then

echo -n $"Starting $prog: "

$nginx_path/sbin/nginx -c /usr/local/nginx/conf/nginx.conf &

RETVAL=$?

[ $RETVAL -eq 0 ] && {

touch /var/lock/subsys/$prog

success $"$prog"

}

echo

else

RETVAL=1

fi

return $RETVAL

}

# Stop daemons.

stop() {

echo -n $"Stopping $prog: "

killproc -d 10 $nigx_path/sbin/nginx

RETVAL=$?

echo

[ $RETVAL = 0 ] && rm -f $nginx_pid /var/lock/subsys/$prog

}

# See how we were called.

case "$1" in

start)

start

;;

stop)

stop

;;

reconfigure)

stop

start

;;

status)

status $prog

RETVAL=$?

;;

*)

echo $"Usage: $0 {start|stop|reconfigure|status}"

exit 1

esac

exit $RETVAL

2、為該腳本增加啟動權限

# chmod 755 /etc/init.d/nginx

3、加為系統服務,自動啟動

# chkconfig --level 2345 nginx on

4、手動啟動

# /etc/init.d/nginx start

# service nginx start

總結

以上是生活随笔為你收集整理的nginx在linux自动启动脚本,nginx的自动启动脚本的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。