![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| copy command failure | mynix | Shell Programming and Scripting | 1 | 12-15-2007 09:35 PM |
| telnet failure | billet75 | AIX | 3 | 08-14-2007 01:09 PM |
| Unzip, copy, and delete loop | spyne | Shell Programming and Scripting | 3 | 03-07-2007 10:30 AM |
| ld failure | handak9 | High Level Programming | 2 | 09-29-2004 07:56 AM |
| CPU failure??? | 98_1LE | UNIX for Dummies Questions & Answers | 1 | 01-23-2001 02:38 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
while loop to copy on failure
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: 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
}
|
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
Quote:
If I understand the problem correctly #!/bin/ksh file_cntr=0 while [[ $file_cntr != 4 ]]; do # do copy file scp ... # do get file_cntr value file_cntr=`ssh root@myComp "ls -l ...` done |
|
#3
|
|||
|
|||
|
Quote:
Also, you can transfer multiple at the same time which would save time on connection and negotiation.... Code:
scp veryOriginalName.1 \
veryOriginalName.2 \
veryOriginalName.3 \
veryOriginalName.4 root@myComp:/tmp/
if test "$?" = "0"
then
echo success
VAR = `ssh root@myComp "ls -l /tmp/veryOriginalName.*" | grep "-" | wc -l`
else
echo failure
fi
|
|||
| Google The UNIX and Linux Forums |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|