编程技术分享平台

网站首页 > 技术教程 正文

nginx启动脚本(nginx的启动命令)

xnh888 2024-09-12 22:40:28 技术教程 32 ℃ 0 评论

#!/bin/sh

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

case $1 in

start)

if [ -f /usr/local/nginx/logs/nginx.pid ]; then

action "nginx is running" /bin/false

# echo_failure

# echo "nginx is running"

else

/usr/local/nginx/sbin/nginx

# echo_success

# echo "nginx is starting"

action "nginx is starting..." /bin/true

fi

;;


stop)

if [ -f /usr/local/nginx/logs/nginx.pid ]; then

pkill nginx

action "nginx is stopping..." /bin/true

# echo_success

# echo "nginx is stopped"

else


action "nginx is not started" /bin/false

# echo_failure

# echo "nginx is not started"

fi

;;

restart)

if [ -f /usr/local/nginx/logs/nginx.pid ]; then

pkill nginx

action "nginx is stopping..." /bin/true

# echo_success

# echo "nginx is stopped"

sleep 2

# /usr/local/nginx/sbin/nginx -s reload

action "nginx is restarting..." /bin/true

/usr/local/nginx/sbin/nginx

# echo_success

# echo "nginx is restarted"

else

action "nginx is not running" /bin/false

# echo_failure

# echo "nginx is not running"

sleep 2

# /usr/local/nginx/sbin/nginx -s reload

action "nginx is restarting..." /bin/true

/usr/local/nginx/sbin/nginx

# echo_success

# echo "nginx is started"

fi

;;

*)

echo "please input 'sh $0 start|stop|status|restart'"

;;

esac

Tags:

本文暂时没有评论,来添加一个吧(●'◡'●)

欢迎 发表评论:

最近发表
标签列表