bkctld-stop: use pkill instead of a loop

This commit is contained in:
Jérémy Lecour 2020-04-02 23:34:14 +02:00 committed by Jérémy Lecour
parent b141daca29
commit 09d2014db3

View file

@ -18,11 +18,8 @@ test -d "${jail_path}" || error "${jail_name}: jail is missing."
"${LIBDIR}/bkctld-is-on" "${jail_name}" || exit 0
pid=$(cat "${jail_path}/${SSHD_PID}")
for conn in $(ps --ppid "${pid}" -o pid=); do
kill "${conn}"
done
if kill "${pid}"; then
if pkill --parent "${pid}" && kill "${pid}"; then
notice "${jail_name}: jail has been stopped [${pid}]"
umount --lazy --recursive "${jail_path}/dev"