Skip to content
This repository was archived by the owner on Oct 6, 2023. It is now read-only.

Commit 2fbbe14

Browse files
committed
refactor kill_process_if_running to term_process
1 parent eb31efd commit 2fbbe14

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

entrypoint.sh

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -151,15 +151,15 @@ on_failure() {
151151
### process control
152152
######################################################################################
153153

154-
kill_process_if_running() {
154+
term_process() {
155155

156156
local -r base=$(basename "$1")
157157
local -r pid=$(pidof "$base")
158158

159159
if [[ -n $pid ]]; then
160-
log "killing $base"
161-
kill -TERM "$pid"
162-
on_failure warn "unable to kill $base"
160+
log "terminating $base"
161+
kill "$pid"
162+
on_failure warn "unable to terminate $base"
163163
else
164164
log "$base was not running"
165165
fi
@@ -180,10 +180,10 @@ stop_mount() {
180180
local args=()
181181
if is_logging_debug; then
182182
args+=('-v')
183+
log "un-mounting $type filesystem from $path"
183184
fi
184185
args+=("$path")
185186

186-
log "un-mounting $type filesystem from $path"
187187
umount "${args[@]}"
188188
on_failure warn "unable to un-mount $type filesystem from $path"
189189

@@ -194,9 +194,9 @@ stop_mount() {
194194

195195
stop_nfsd() {
196196

197-
log 'stopping nfsd'
197+
log 'terminating nfsd'
198198
$PATH_BIN_NFSD 0
199-
on_failure warn 'unable to stop nfsd. if it had started already, check Docker host for lingering [nfsd] processes'
199+
on_failure warn 'unable to terminate nfsd. if it had started already, check Docker host for lingering [nfsd] processes'
200200
}
201201

202202
stop_exportfs() {
@@ -216,22 +216,22 @@ stop() {
216216
log_header 'terminating ...'
217217

218218
if is_kerberos_requested; then
219-
kill_process_if_running "$PATH_BIN_RPC_SVCGSSD"
219+
term_process "$PATH_BIN_RPC_SVCGSSD"
220220
fi
221221

222222
stop_nfsd
223223

224224
if is_idmapd_requested; then
225-
kill_process_if_running "$PATH_BIN_IDMAPD"
225+
term_process "$PATH_BIN_IDMAPD"
226226
fi
227227

228228
if is_nfs3_enabled; then
229-
kill_process_if_running "$PATH_BIN_STATD"
229+
term_process "$PATH_BIN_STATD"
230230
fi
231231

232-
kill_process_if_running "$PATH_BIN_MOUNTD"
232+
term_process "$PATH_BIN_MOUNTD"
233233
stop_exportfs
234-
kill_process_if_running "$PATH_BIN_RPCBIND"
234+
term_process "$PATH_BIN_RPCBIND"
235235
stop_mount "$MOUNT_PATH_NFSD"
236236
stop_mount "$MOUNT_PATH_RPC_PIPEFS"
237237

@@ -701,7 +701,7 @@ boot_main_nfsd() {
701701
boot_helper_start_daemon "starting rpc.nfsd on port $port with $threads server thread(s)" $PATH_BIN_NFSD "${args[@]}"
702702

703703
if ! is_nfs3_enabled; then
704-
kill_process_if_running "$PATH_BIN_RPCBIND"
704+
term_process "$PATH_BIN_RPCBIND"
705705
fi
706706
}
707707

0 commit comments

Comments
 (0)