I'm trying to do an automated SCP (passwordless auth is already set up) from a bash script...
My problem is that on the receiving end, the computer will sometimes NOT actually get my files. BUT if I loop enough times (by hand at the moment) calling an 'ls' on those files, I can see if the files got there, otherwise resend.
This works, believe it or not... maybe somethings screwed up with my SCP?
Either way, I want to now put this functionality into a script, so I can just get the 'ls' of my files, see if there are 4 lines (pre-grepped for just files, no headers) -- aka 4 files -- and if there are, continue... else loop.
Pseudo-code:
do {
scp veryOriginalName.1 root@myComp:/tmp
scp veryOriginalName.2 root@myComp:/tmp
scp veryOriginalName.3 root@myComp:/tmp
scp veryOriginalName.4 root@myComp:/tmp
VAR = ssh root@myComp "ls -l /tmp/veryOriginalName.*" | grep "-" | wc -l
} while {
VAR != 4
}