Nginx启动脚本

简介:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/bin/bash
# chkconfig: - 30 21
# description: http service.
# Source Function Library
/etc/init .d /functions
# Nginx Settings
 
NGINX_SBIN= "/usr/local/nginx/sbin/nginx"
NGINX_CONF= "/usr/local/nginx/conf/nginx.conf"
NGINX_PID= "/usr/local/nginx/logs/nginx.pid"
RETVAL=0
prog= "Nginx"
 
start() {
         echo  -n $ "Starting $prog: "
         mkdir  -p  /dev/shm/nginx_temp
         daemon $NGINX_SBIN -c $NGINX_CONF
         RETVAL=$?
         echo
         return  $RETVAL
}
 
stop() {
         echo  -n $ "Stopping $prog: "
         killproc -p $NGINX_PID $NGINX_SBIN -TERM
         rm  -rf  /dev/shm/nginx_temp
         RETVAL=$?
         echo
         return  $RETVAL
}
 
reload(){
         echo  -n $ "Reloading $prog: "
         killproc -p $NGINX_PID $NGINX_SBIN -HUP
         RETVAL=$?
         echo
         return  $RETVAL
}
 
restart(){
         stop
         start
}
 
configtest(){
     $NGINX_SBIN -c $NGINX_CONF -t
     return  0
}
 
case  "$1"  in
   start)
         start
         ;;
   stop)
         stop
         ;;
   reload)
         reload
         ;;
   restart)
         restart
         ;;
   configtest)
         configtest
         ;;
   *)
         echo  $ "Usage: $0 {start|stop|reload|restart|configtest}"
         RETVAL=1
esac
 
exit  $RETVAL


注:这个脚本不是我自己写的,来源于互联网!





      本文转自limingyu0312  51CTO博客,原文链接:http://blog.51cto.com/limingyu/1899448,如需转载请自行联系原作者




相关文章
|
17天前
|
缓存 负载均衡 应用服务中间件
Nginx安装与使用: Nginx之编译安装的nginx加入systemctl、Nginx命令
Nginx安装与使用: Nginx之编译安装的nginx加入systemctl、Nginx命令
50 0
|
4月前
|
Ubuntu 应用服务中间件 网络安全
|
9月前
|
缓存 负载均衡 前端开发
【2022】Nginx专题:部署Nginx服务与配置文件说明
【2022】Nginx专题:部署Nginx服务与配置文件说明
95 1
|
7月前
|
应用服务中间件 Linux nginx
nginx启动
nginx启动
|
9月前
|
缓存 应用服务中间件 nginx
【Nginx二】——Nginx常用命令 配置文件
【Nginx二】——Nginx常用命令 配置文件
71 0
|
9月前
|
应用服务中间件 nginx Docker
Nginx中常用命令与Nginx.conf配置文件详解
Nginx中常用命令与Nginx.conf配置文件详解
78 2
Nginx中常用命令与Nginx.conf配置文件详解
|
11月前
|
应用服务中间件 nginx
nginx启动无反应
nginx启动无反应
|
存储 缓存 负载均衡
Nginx中 配置文件 nginx.conf 详解
Nginx中 配置文件 nginx.conf 详解
661 0
Nginx中 配置文件 nginx.conf 详解
|
缓存 应用服务中间件 nginx
|
应用服务中间件 nginx
Nginx 命令
Nginx 命令
114 0