sFTP result


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting sFTP result
# 1  
Old 08-01-2007
sFTP result

Hi all,

batchfile
======
lcd /home/data/
cd /tmp/source/
get "*.temp.ack"
quit

Result from sftp
============
1111.temp.ack| 0B | 0B/s | TOC: 00:00:01 | 100%^M ^M2222.temp.ack | 0B | 0B/s | TOC: 00:00:01 | 100%^M ^M3333.temp.ack | 0B | 0B/s | TOC: 00:00:01 | 100%^M ^M

As I don't know how many records I would be retrieving, counting the number of 100% won't help. Any idea on how to ensure the sftp that I just performed is a successful one? Please help!
# 2  
Old 08-01-2007
There some ways to make sure that the FTP is successfull. one of them is:

count the number of records in the source before FTPing and write it to another file.

then ftp both the files(data and the count files) to the target host.

in the target host you could count the number of records present in the data file and the number present in the count file should match. if it matches then its successful else there is some problem with the FTP.

I hope this helps
# 3  
Old 08-01-2007
may I ask how "count the number of records in the source", can be done?

i have tried "ls -l *.temp.ack | wc -l", but i got

Couldn't stat file ``/tmp/source/wc'', error msg: syserr: No such file or directory, file: wc
Couldn't stat file ``/tmp/source/-l'', error msg: syserr: No such file or directory, file: -l


Please help!
# 4  
Old 08-01-2007
try this:

on the source server
Code:
 sed -n '$=' datafile > count_file

FTP both count_file and datafile

then on the target server try this


Code:
 
sed '$=' datafile |read TGT_COUNT
cat count_file |read SOURCE_COUNT

if [[ $TGT_COUNT -eq $SOURCE_COUNT ]]; then

echo "FTP SUCCESSFULL"

else
echo "FTP FAILED"
exit 1
fi

# 5  
Old 08-01-2007
I don't believe i would have access to those commands, would it be possible that I try to figure out whether the sftp process was a sucess by looking at the output? Would it be possible to check whether all percentage is 100% after "TOC: HH:MM:SS |"? Please help, thanks!


Output from sftp process
===================
1111.temp.ack| 0B | 0B/s | TOC: 00:00:01 | 100%^M ^M2222.temp.ack | 0B | 0B/s | TOC: 00:00:01 | 100%^M ^M3333.temp.ack | 0B | 0B/s | TOC: 00:00:01 | 100%^M ^M
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to compare the current result with previous line result.?

Hi Gurus, I have requirement to compare current result with previous reuslt. The sample case is below. 1 job1 1 1 job2 2 1 job3 3 2 job_a1 1 2 job_a2 2 2 job_a3 3 3 job_b1 1 3 job_b2 2 for above sample file, GID is group ID, for input line, the job run... (1 Reply)
Discussion started by: ken6503
1 Replies

2. UNIX for Dummies Questions & Answers

Sftp using batchfile - storing result local

I'm making an sftp-connection to a remote server. I want the result of an ls-command in a local file and the result of ls on another folder in another local file. Because everything has to go as fast a possible I wan't to do everyting in one connection. The command I use is : psftp -v -batch -b... (4 Replies)
Discussion started by: pistach
4 Replies

3. Shell Programming and Scripting

Sftp : not able to print the echo statements after the sftp transfer

I had the below sftp script working perfectly but the problem is I am not able to send the echo statements . #!/bin/sh echo "Starting to sftp..." sftp admin@myip << END_SCRIPT cd /remotepath/ lcd /localpath/ mget myfiles*.csv bye END_SCRIPT echo "Sftp successfully." echo echo... (11 Replies)
Discussion started by: scriptscript
11 Replies

4. Red Hat

Chroot sftp users, remote sftp login shows wrong timestamp on files

Hello, I have a weird issue, I have RHEL 5.7 running with openssh5.2 where sftpgroup OS group is chroot. I see the difference difference in timestamp on files, when I login via ssh and SFTP, I see four hour difference, is something missing in my configuration. #pwd... (8 Replies)
Discussion started by: bobby320
8 Replies

5. Shell Programming and Scripting

SFTP-how to log individual sftp command error while executing shell script

Hi, I have situation where i need to automate transferring 10000+ files using sftp. while read line do if ; then echo "-mput /home/student/Desktop/folder/$line/* /cygdrive/e/folder/$line/">>sftpCommand.txt fi done< files.txt sftp -b sftpCommand.txt stu@192.168.2.1 The above... (1 Reply)
Discussion started by: noobrobot
1 Replies

6. UNIX for Dummies Questions & Answers

what is the result of this?

if ] (1 Reply)
Discussion started by: prathimahsc
1 Replies

7. AIX

SFTP Failed---Request for subsystem 'sftp' failed on channel 0

Hi, While I am trying SFTP my machine to another unix machine , it was working fine till 10 min back. But now i am getting the below error "Request for subsystem 'sftp' failed on channel 0" Could you please someone help me to solve or analyise the root cause... Cheers:b:, Mahiban (0 Replies)
Discussion started by: mahiban
0 Replies

8. UNIX for Dummies Questions & Answers

display the result of wc -l with words before and after the result

hello showrev -p | wc -l returns: 381 What to do in case I want to have this output: number of lines returned by showrev -p is: 381 thx (3 Replies)
Discussion started by: melanie_pfefer
3 Replies

9. Shell Programming and Scripting

Outputting formatted Result log file from old 30000 lines result log<help required>

Well I have a 3000 lines result log file that contains all the machine data when it does the testing... It has 3 different section that i am intrsted in 1) starting with "20071126 11:11:11 Machine Header 1" 1000 lines... "End machine header 1" 2) starting with "20071126 12:12:12 Machine... (5 Replies)
Discussion started by: vikas.iet
5 Replies

10. Shell Programming and Scripting

sftp result

Hi, I have a sftp account to another server, from which I need to find out all the files match "*.abc.*.xml" pattern in a certain directory. I have a batchfile as follows cd /tmp ls -l *.abc.*.xml quit then I run output=`/usr/local/bin/sftp -B $batchfile $USER@$HOST` the result looks... (2 Replies)
Discussion started by: mpang_
2 Replies
Login or Register to Ask a Question