I have two scripts. First one is basically wrapper that calls subscript and sets timeout.
#!/bin/bash # wrapper_script timeout --signal=SIGTERM 50 main_script.sh
And if execution of main_script.sh takes longer than 50 s, I am trying to catch SIGTERM
#!/bin/bash # main_script.sh trap "echo 'Reached time limit'; rm $log_file; exit" SIGHUP SIGINT SIGTERM
I never get message "Reached time limit" printed, child script gets killed, but it does not catch SIGTERM. Do I miss something?