In my script, I set set -e to stop processing if an error occurs. It works well for all teams running in the foreground, but some of my commands must run in parallel in the background. Unfortunately, if the background process crashes, the script does not stop, although the flag is set -e .
An example of using the foreground process.
#!/bin/bash set -e ls -l no_file sleep 100
The background process example does not work.
#!/bin/bash set -e ls -l no_file & sleep 100
How to handle background process crashes?
source share