sftp status check


 
Thread Tools Search this Thread
Operating Systems HP-UX sftp status check
# 1  
Old 04-28-2005
Tools sftp status check

Hi All,

I am having shell scripts that make use of ftp to fetch data from one hp-ux box to another. Currently we are migrating these scripts to sftp. Is it a straight forward one? Also, please clarify my following doubts:

1) In ftp we check the success of ftp by verifying the status codes like 200,226 etc. We are not able to identify any similar codes in sftp. How do we verify the status of sftp process , within scripts?

2)Is there any capability that ftp has and will be lost after migration to sftp?

Please shed some light in to this as the requirement is a bit urgent.

Thanks in advance
# 2  
Old 04-29-2005
The -b flag in OpenSSH causes sftp to run in batch mode. While in batch mode, sftp will exit and return an error code of "0" when any get, put, etc. fails. sftp returns a "1" and exits if the connection to the remote fails, or if the user cancels using CTRL-C.

That's all there is as far as I know.
# 3  
Old 05-10-2005
Thats all we found too. We ended up using ls commands and comparing file lists, dates and sizes to make sure the files transferred successfully.
maybe in the next release there will be more usefull output....
# 4  
Old 08-09-2007
Question novis2

I have this same problem.
I am converting some scriped UNIX ftp scripts
to sftp scripts.
For the FTP scripts the FTP return codes are saved to a work file and compared to the directory that mput or mget files before and after the FTP and counts of 150 and 226 return codes are compared and if equal, then all ftp's were treated as successful.
The 200, 150 & 226 ftp return codes indicate a successful FTP for each file.
I can not find any return codes for sftp.
How will I know the files had a successful put file*
or get file* using sftp ?
Would the return code of 0 or 1 from sftp after one or many put's or get's be all that I need to check? Or in other words is the transfer of one or many files all or none?
# 5  
Old 02-27-2008
script hacks fraught with peril

Looks like Trott & Rolsky's Perl Net::SFTP Module can help with this dilemma.

What I've learned is the standard SFTP shell client is too primitive for rigorous activity, requiring "hacks" to parse debug responses.

Since SFTP technically is not a standard (yet), in some ways it's "not ready for prime time" (ie, critical production applications).
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Exit Status 255, Connection closed in SFTP

I'm trying to connect from Server A to Server B to transfer files from A to B. I'm using NUID A1 in Server A and NUID A2 in Server B. I have done the following the steps to setup password-less login. 1. Add the public key of A1 in A to the Authorized keys of A2 in B. 2. Add the public key of... (4 Replies)
Discussion started by: sanchid312
4 Replies

2. Shell Programming and Scripting

How to check the status of sftp connection is successful or not in Linux?

Hi All, We are working on linux with putty terminal for file transferring using SFTP server... here we want to know /We have Urgent Requirement If SFTP connection is successfull then we should get .txt log file in target locaton as "Success/Failure" Please provide batch script for above... (7 Replies)
Discussion started by: sravanreddy
7 Replies

3. Red Hat

Check PSU Status

Hello, We have a cluster and each server have 2 PSU. An alarm should be raised in case of failure so we need to check periodically the PSU status wth a script. The first idea was to check with ipmitool but this take some time to get the data and we face some other issues now due to that... (1 Reply)
Discussion started by: @dagio
1 Replies

4. Shell Programming and Scripting

Check HD status

I have some server ( IBM , Dell ) , our data center is not in the same location with office , therefore , I do not know if the HD lamp is flash when the HD is fault , can advise if I can write a script to check if the HD is normal running or not ? thanks (1 Reply)
Discussion started by: ust
1 Replies

5. Shell Programming and Scripting

Script for SFTP Status Checking

Greetings... I have to construct shell script to check the SFTP status, Define a global variable (say sftpStatus). Set it to default value "success" when you define it first time outside the script. check the current SFTP status (say currentStatus - local variable within the script) if... (16 Replies)
Discussion started by: manju98458
16 Replies

6. Solaris

SFTP Status

hey, i have been looking around and i cant find anything and dont believe there is no way to do it. all i want is to know the status of my sftp. want to know if the put or get is successful. in FTP you get 220 etc and this worked for me. but not so striaght forward with SFTP. anyone have... (1 Reply)
Discussion started by: dshakey
1 Replies

7. AIX

check the status of ypbind

hello , How do i to check the status of ypbind on AIX(5.3) platform ? Thanks AVK Linux (1 Reply)
Discussion started by: avklinux
1 Replies

8. Solaris

Exit status 255 on sftp

HI guys When i try SFTP to a machine using a user account whose entry in /etc/passwd as follows user:x:8005:508::/export/home/user:/bin/false and i am not placed my keys over there i am using the password option in the sftp Since the keys are not there it ask for the password ... (5 Replies)
Discussion started by: GIC1986
5 Replies

9. Shell Programming and Scripting

check the status and send an email with status

Hi, We have a text file which has the following data. ISA~00~ ~00~ ~ZZ~VISTN ~ZZ~U1CAD ~051227~183 7~U~00200~000011258~0~P~< GS~FA~EE05J~U1CAD~051227~1831~000011258~X~002002 ST~997~0001 AK1~SH~247 AK2~856~2470001 AK5~A AK2~856~2470002 AK5~A... (3 Replies)
Discussion started by: isingh786
3 Replies

10. Shell Programming and Scripting

Ftp Status Check

Hi, I'm using the below script to ftp the file passed as 3rd argument. I'm passing the source and destination directory as 1st and 2nd argument. This script does the ftp successfully. The script displays the echo before ftp stmt and does the ftp and does not display the stmts after that... (4 Replies)
Discussion started by: acheepi
4 Replies
Login or Register to Ask a Question