Skip to content
Snippets Groups Projects
Commit e02c51ec authored by Seblu's avatar Seblu
Browse files

checkservices: Try to fix infinite loop

There is probably an infinite loop in the code. When it happen display an error
parent 2c41bdad
No related branches found
No related tags found
No related merge requests found
......@@ -207,6 +207,14 @@ if (( $restart == 1 && ${#needy[*]} > 0 )) && confirm_restart; then
running_pids=( $(jobs -p) )
(( ${#running_pids[*]} )) || break
wait -n
# ensure we are not at 1st infinite loop
# if wait doesn't return a process exit value someting wrong happen
if (( $? == 127 )); then
echo "${c_error}** Unable to wait processes to finish${c_rst}" >&2
echo "${c_error}** Registered PIDs: ${registered_pids[*]}${c_rst}" >&2
echo "${c_error}** Running PIDs: ${running_pids[*]}${c_rst}" >&2
break
fi
for pid in "${!registered_pids[@]}"; do
in_array "$pid" "${running_pids[@]}" && continue
# show units status
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment