blob: 18be537cb6beebef4b439dfb13b6435b8cc19cd9 (
plain)
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
|
#!/bin/bash
#
# Script to manage the various Gluster systemd services
#
#
# ** DO NOT INCLUDE /etc/rc.d/init.d/functions **
# ** This will break all automation because of systemctl redirect **
#
. /etc/rc.d/init.d/glusterd.functions
PATH="$PATH:/usr/local/bin:/usr/bin:/bin:/usr/sbin"
# BEGIN functions copied out of /etc/rc.d/init.d/functions
if [ -z "${BOOTUP:-}" ]; then
if [ -f /etc/sysconfig/init ]; then
. /etc/sysconfig/init
else
# This all seem confusing? Look in /etc/sysconfig/init,
# or in /usr/share/doc/initscripts-*/sysconfig.txt
BOOTUP=color
RES_COL=60
MOVE_TO_COL="echo -en \\033[${RES_COL}G"
SETCOLOR_SUCCESS="echo -en \\033[1;32m"
SETCOLOR_FAILURE="echo -en \\033[1;31m"
SETCOLOR_WARNING="echo -en \\033[1;33m"
SETCOLOR_NORMAL="echo -en \\033[0;39m"
LOGLEVEL=1
fi
if [ "$CONSOLETYPE" = "serial" ]; then
BOOTUP=serial
MOVE_TO_COL=
SETCOLOR_SUCCESS=
SETCOLOR_FAILURE=
SETCOLOR_WARNING=
SETCOLOR_NORMAL=
fi
fi
success() {
[ "$BOOTUP" != "verbose" -a -z "${LSB:-}" ] && echo_success
return 0
}
# Log that something failed
failure() {
local rc=$?
[ "$BOOTUP" != "verbose" -a -z "${LSB:-}" ] && echo_failure
[ -x /bin/plymouth ] && /bin/plymouth --details
return $rc
}
# Run some action. Log its output.
action() {
local STRING rc
STRING=$1
echo -n "$STRING "
shift
"$@" && success $"$STRING" || failure $"$STRING"
rc=$?
echo
return $rc
}
echo_success() {
[ "$BOOTUP" = "color" ] && $MOVE_TO_COL
echo -n "["
[ "$BOOTUP" = "color" ] && $SETCOLOR_SUCCESS
echo -n $" OK "
[ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
echo -n "]"
echo -ne "\r"
return 0
}
echo_failure() {
[ "$BOOTUP" = "color" ] && $MOVE_TO_COL
echo -n "["
[ "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE
echo -n $"FAILED"
[ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
echo -n "]"
echo -ne "\r"
return 1
}
# END copy from /etc/rc.d/init.d/functions
_start_service()
{
_service=$1
_desc=$2
[ -z "$_desc" ] && _desc=$_service
action "Starting $_desc..." /bin/systemctl start "$_service"
}
_stop_service()
{
_service=$1
_desc=$2
[ -z "$_desc" ] && _desc=$_service
action "Stopping $_desc..." /bin/systemctl stop "$_service"
}
# SHD Management Functions
start_shd()
{
_start_service glusterd-shd "self-heal daemon"
}
stop_shd()
{
_stop_service glusterd-shd "self-heal daemon"
}
restart_shd()
{
stop_shd
start_shd
}
# NFSd Management Functions
start_nfsd()
{
_start_service glusterd-nfsd "nfs daemon"
}
stop_nfsd()
{
_stop_service glusterd-nfsd "nfs daemon"
}
restart_nfsd()
{
stop_nfsd
start_nfsd
}
# GFProxyd Management Functions
start_gfproxyd()
{
_start_service glusterd-gfproxyd "gfproxy daemon"
}
stop_gfproxyd()
{
_stop_service glusterd-gfproxyd "gfproxy daemon"
}
restart_gfproxyd()
{
stop_gfproxyd
start_gfproxyd
}
# mgmt daemon Management Functions
start_mgmt()
{
_start_service glusterd-mgmt "mgmt daemon"
}
stop_mgmt()
{
_stop_service glusterd-mgmt "mgmt daemon"
pkill -f '^/usr/sbin/glusterd.*'
}
restart_mgmt()
{
stop_mgmt
start_mgmt
}
start()
{
start_mgmt
start_nfsd
start_shd
#start_gfproxyd
}
stop()
{
stop_mgmt
stop_nfsd
stop_shd
#stop_gfproxyd
# Stop the bricks, since they are not managed by systemd
pkill -f '^/usr/sbin/glusterfsd.*'
}
restart()
{
stop
start
}
case $1 in
start) start ;;
start_nfsd) start_nfsd ;;
start_shd) start_shd ;;
stop) stop ;;
stop_nfsd) stop_nfsd ;;
stop_shd) stop_shd ;;
#stop_gfproxyd) stop_gfproxyd ;;
restart) restart;;
restart_nfsd) restart_nfsd ;;
restart_shd) restart_shd ;;
#restart_gfproxyd) restart_gfproxyd ;;
checkquorum) check_quorum ;;
esac
exit 0
|