I need to copy several files to remote server.
for database in `mysql -Bse"show databases" | grep '^us' `
do
time scp $database.gz gs://tbl_name/ &
done
I use & to push the process in the background so that the script can continue processing the next file. The problem is that 1 out of 10 files are not being able to transfer due to network problem. But I can not check the return code and hence do not know which files have failed.
You can wait for specific processes and get the status from that: