循序Rsync
FAIL=0
for i in a b c d e
do
echo $i
dir=/srv/dev-disk-by-label-data/minio/${i}
mkdir $dir
#你要做的rsync
rsync -avP /srv/dev-disk-by-label-data/minio/omv/miniserver64.vdi $dir/ &
echo "Wait job: `jobs -p`"
wait
done
# 對每一個子行程執行 wait
for job in `jobs -p`
do
echo
echo "Wait job: ${job}"
wait $job || let FAIL+=1
done
# 檢查失敗工作數
if [ $FAIL -eq 0 ]; then
echo
echo "All jobs are done"
else
echo
echo "${FAIL} jobs fail!"
fi
Last updated