I've got a simple script to create directories on a remote server using SSH:
while read memberName; do
ssh ${serverPath} "mkdir -p ${filePath}"
wait
done < sqlRes.txt
(I've simplified it a bit - those variables do exist and are fine).
If I make each SSH call a background job (with &), it works better but not completely (it should create 200 directories, only doing 170, for example).
As it is, it exits the loop after the first entry in sqlRes.txt with no error message and a successful return status.
I've tried sleep and wait commands but neither help.
I'm guessing there's maybe a limit of sub-shells but I thought 'wait' should ensure each one is closed before I try the next?
Any ideas, please?
FYI - ksh in Linux RedHat