Skip to content

Instantly share code, notes, and snippets.

@dolanor
Created August 3, 2016 10:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dolanor/cb2ed03fccc373882db51a7682511164 to your computer and use it in GitHub Desktop.
Save dolanor/cb2ed03fccc373882db51a7682511164 to your computer and use it in GitHub Desktop.
A wait script that will return the list of the return code for a list of pid that we want to wait on
#!/bin/bash
# to get pids, you can just do a
# myprocess &
# pids+="$! "
pids="$@"
rets=""
for i in $pids
do
wait $i
ret=$?
if [ $ret -ne 0 ]
then
echo "failed waiting for a service"
rets+="$ret "
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment