Supondo que o resto do seu código funcione:
mySCP="scp -q -o StrictHostKeyChecking=no -o BatchMode=yes -o UserKnownHostsFile=/dev/null -o HostbasedAuthentication=no"
rm -Rf /tmp/logdata
mkdir /tmp/logdata
myCmd="$mySCP -r xyz2384:/d/d1/run_logs/results/trail/log.txt /tmp/logdata/"
while true; do
$myCmd
myResult=$?
date=$(date +'%m/%d/%Y %H:%M:%S')
if [ $myResult -eq 0 ]; then
echo "SUCCESS – Log data copying, at $date."
break
else
echo "**FAILED – Log data copying, at $date."
echo "mySCP return code: $myResult"
echo "Retrying..."
# You can probably increase this delay
sleep 10
fi
done