Forward TERM signal to all sub-processes
It only requires you to prepend all commands with
run, then if the script process is
TERM, it will forward the signal
to the processes you instanciated using the run command if they are still alive, if they are not, they are just ignored.
This was designed to make docker containers shutdown faster when you have a starting script to run (in this example we are
npm install and
npm start), this works because when requested to stop the container, docker will send a TERM
signal to the process with id
1, which is the first command ran by the
So if this script receives
TERM it will forward it leading every process to shutdown, so the container can die peacefully.