-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathloadnginx.sh
More file actions
executable file
·75 lines (65 loc) · 854 Bytes
/
loadnginx.sh
File metadata and controls
executable file
·75 lines (65 loc) · 854 Bytes
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
72
73
74
75
#!/bin/bash
NGINX_HOME="$HOME/local/nginx"
NGINX_PIDFILE="$NGINX_HOME/logs/nginx.pid"
function start()
{
if [ -f $NGINX_PIDFILE ]
then
stop
else
$NGINX_HOME/sbin/nginx
fi
if [ $? -eq 0 ]
then
echo "start nginx success."
else
echo "start nginx failed."
fi
return $?
}
function stop()
{
if [ -f $NGINX_PIDFILE ]
then
$NGINX_HOME/sbin/nginx -s stop
fi
if [ $? -eq 0 ]
then
echo "stop nginx success."
else
echo "stop nginx failed."
fi
return $?
}
function restart()
{
stop
sleep 1
start
if [ $? -eq 0 ]
then
echo "restart nginx success."
else
echo "restart nginx failed."
fi
}
function reload()
{
$NGINX_HOME/sbin/nginx -s reload
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
reload)
reload
;;
*)
echo "Usage: $0 {start|stop|restart|reload}"
esac