网站首页 > 技术教程 正文
#!/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
猜你喜欢
- 2024-10-10 keepalived + nginx 初步实现高可用
- 2024-10-10 Nginx的高可用(nginx 高可用)
- 2024-09-12 「Centos」在nginx服务器中配置php和mysql
- 2024-09-12 Nginx参数详解(nginx 426)
- 2024-09-12 Nginx常见故障502等解决方案(nginx504报错排查流程)
- 2024-09-12 nginx的SCRIPT_NAME, PATH_INFO多了index.php问题
- 2024-09-12 nginx过滤请求关键字(nginx waf 过滤规则)
- 2024-09-12 nginx反向代理后,刷新页面无法访问,404错误,解决方法
- 2024-09-12 Nginx 备忘录 10. Keepalived 实现 Nginx 高可用
- 2024-09-12 shell脚本安装nginx和启动关闭nginx
你 发表评论:
欢迎- 最近发表
- 标签列表
-
- 下划线是什么 (87)
- 精美网站 (58)
- qq登录界面 (90)
- nginx 命令 (82)
- nginx .http (73)
- nginx lua (70)
- nginx 重定向 (68)
- Nginx超时 (65)
- nginx 监控 (57)
- odbc (59)
- rar密码破解工具 (62)
- annotation (71)
- 红黑树 (57)
- 智力题 (62)
- php空间申请 (61)
- 按键精灵 注册码 (69)
- 软件测试报告 (59)
- ntcreatefile (64)
- 闪动文字 (56)
- guid (66)
- abap (63)
- mpeg 2 (65)
- column (63)
- dreamweaver教程 (57)
- excel行列转换 (56)
本文暂时没有评论,来添加一个吧(●'◡'●)