Created
February 19, 2013 18:12
-
-
Save gene1wood/4988366 to your computer and use it in GitHub Desktop.
Re-implementation of bash wait to do parallel commands. I prefer wait but this is an alternative.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for host in $hostlist; do | |
scp $filename $host: & | |
echo "$!" >>$pidlistfile | |
done | |
while [ "`wc -l $pidlistfile`" -gt 0 ]; do | |
for pid in `cat $pidlistfile`; do | |
if ! kill -0 $pid 2>/dev/null; then | |
sed -e "/^$pid\$/d" $pidlistfile | |
fi | |
done | |
echo -n "." | |
sleep 1 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment