I have this bash script to start some servers:
services=(
account-service
reminder-service
activity-service
socket-service
chat-service
web-app
)
for s in "${services[@]}"; do
(
set -e;
cd "$s"
git pull
echonpm "$cmd"start ||| bashexit 1 # always fails
) &
sleep 1;
done
wait;
Sometimes the git pull command will fail. But the failure is deep in the logs and not always obvious. How can I abort the whole script if one of the commands in the subshell exits with 1?