#!/bin/bash # Stop NPM from complaining about useless stuff. export npm_config_loglevel=error # Listen for SIGINT/SIGTERM so the container can be killed with CTRL+C # Also prevents reboot bug where the container freezes for 30-60 seconds asyncRun() { "$@" & pid="$!" trap "echo 'Stopping PID $pid'; kill -SIGTERM $pid" SIGINT SIGTERM # Signal emitted while waiting will make the wait command return code > 128 # Wrap it in a loop that doesn't end before the process is indeed stopped while kill -0 $pid >/dev/null 2>&1; do wait done } cat <