-
Notifications
You must be signed in to change notification settings - Fork 0
/
nginx.plugins.bash
executable file
·68 lines (58 loc) · 1.27 KB
/
nginx.plugins.bash
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
# shellcheck shell=bash
cite about-plugin
about-plugin 'Manage your nginx service'
export NGINX_PATH='/opt/nginx'
pathmunge $NGINX_PATH/sbin after
nginx_reload () {
about 'Reload your nginx config'
group 'nginx'
FILE="${NGINX_PATH}/logs/nginx.pid"
if [[ -e $FILE ]]; then
echo "Reloading NGINX..."
PID=`cat $NGINX_PATH/logs/nginx.pid`
sudo kill -HUP $PID
else
echo "Nginx pid file not found"
return 0
fi
}
nginx_stop () {
about 'Stop nginx'
group 'nginx'
FILE="${NGINX_PATH}/logs/nginx.pid"
if [[ -e $FILE ]]; then
echo "Stopping NGINX..."
PID=`cat $NGINX_PATH/logs/nginx.pid`
sudo kill -INT $PID
else
echo "Nginx pid file not found"
return 0
fi
}
nginx_start () {
about 'Start nginx'
group 'nginx'
FILE="${NGINX_PATH}/sbin/nginx"
if [[ -e $FILE ]]; then
echo "Starting NGINX..."
sudo $NGINX_PATH/sbin/nginx
else
echo "Couldn't start nginx"
fi
}
nginx_restart () {
about 'Restart nginx'
group 'nginx'
FILE="${NGINX_PATH}/logs/nginx.pid"
if [[ -e $FILE ]]; then
echo "Stopping NGINX..."
PID=`cat $NGINX_PATH/logs/nginx.pid`
sudo kill -INT $PID
sleep 1
echo "Starting NGINX..."
sudo $NGINX_PATH/sbin/nginx
else
echo "Nginx pid file not found"
return 0
fi
}