Artificial intelligent assistant

How to send SIGKILLs to entire pipeline? while true; do # process substitution instead of usual pipeline to avoid waiting for all programs handle_input_with_timeout < <( prog1 | prog2 | prog3 ) echo "Data stopped flowing. Trying again" # perminate stuck programs in previous pipeline, then try again sleep 5 done How to reliably get rid of prog1, prog2 and prog3 that can get stuck and hold resources necessary to try again? Can it be done in Bash alone or I need to use cgroups?

This can be done with process groups (suggested here) and `setsid` to start new one:


while true; do

handle_input_with_timeout < <( setsid bash -c '
printf -- "-$$" > /tmp/saved_process_group.pid
prog1 | prog2 | prog3
')
echo "Data stopped flowing. Trying again"
kill -9 $(< /tmp/saved_process_group.pid )

sleep 5
done

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 1b4db761a1276ad9447c056743f35b5b