cgroups_cleanup: clean up shutdown signaling
- do not sleep for the full 90 seconds if processes are dead - re-arrange the order of signals we attempt to send to the processes
This commit is contained in:
parent
a428c325a9
commit
35b88fb42b
@ -203,15 +203,21 @@ cgroup_cleanup()
|
|||||||
{
|
{
|
||||||
cgroup_running || return 0
|
cgroup_running || return 0
|
||||||
ebegin "starting cgroups cleanup"
|
ebegin "starting cgroups cleanup"
|
||||||
local pids
|
local pids loops=0
|
||||||
pids="$(cgroup_get_pids)"
|
pids="$(cgroup_get_pids)"
|
||||||
if [ -n "${pids}" ]; then
|
if [ -n "${pids}" ]; then
|
||||||
kill -s "${stopsig:-TERM}" ${pids} 2> /dev/null
|
|
||||||
kill -s CONT ${pids} 2> /dev/null
|
kill -s CONT ${pids} 2> /dev/null
|
||||||
|
kill -s "${stopsig:-TERM}" ${pids} 2> /dev/null
|
||||||
yesno "${rc_send_sighup:-no}" &&
|
yesno "${rc_send_sighup:-no}" &&
|
||||||
kill -s HUP ${pids} 2> /dev/null
|
kill -s HUP ${pids} 2> /dev/null
|
||||||
sleep "${rc_timeout_stopsec:-90}"
|
kill -s "${stopsig:-TERM}" ${pids} 2> /dev/null
|
||||||
yesno "${rc_send_sigkill:-yes}" &&
|
while [ -n "$(cgroup_get_pids)" ] &&
|
||||||
|
[ "${loops}" -lt "${rc_timeout_stopsec:-90}" ]; do
|
||||||
|
loops=$((loops+1))
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
pids="$(cgroup_get_pids)"
|
||||||
|
[ -n "${pids}" ] && yesno "${rc_send_sigkill:-yes}" &&
|
||||||
kill -s KILL ${pids} 2> /dev/null
|
kill -s KILL ${pids} 2> /dev/null
|
||||||
fi
|
fi
|
||||||
cgroup2_remove
|
cgroup2_remove
|
||||||
|
Loading…
Reference in New Issue
Block a user