Sponsored Content
Top Forums Shell Programming and Scripting Not able to capture sftp error in Korn Shell Post 302851693 by Soham on Monday 9th of September 2013 01:19:29 PM
Old 09-09-2013
Not able to capture sftp error in Korn Shell

I am not able to capture error condition in sftp in Korn Shell

Code:
#!/bin/ksh
sftp  batch@uat >abc 2>&1 << ENDFILE
   cd public
   put /data/WELCOME_55
ENDFILE
ret_val=$?
if [[ $ret_val -eq 0 ]]
then
   print file "copied successfully"
else
   print file "NOT copied successfully"
fi
return 0

Now the file /data/WELCOME_55 does not exist. I am seeing the error message in file abc. But ret_val is zero.

Any help?

Thanks - Soham
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

korn shell + sftp + list files

Hello!!! I need a korn shell script in AIX that inside sftp environment, changes a remote directory, lists the files inside it, and stores in an array. I got it working before make a sftp, but after.. I can't.. The way it is, it lists the files in local path... so.. not what I want, but... (1 Reply)
Discussion started by: alienET
1 Replies

2. Shell Programming and Scripting

Command ignored after sftp - korn shell

Hi all Trying to run my korn shell script, I got no messages after the sftp. The "finished" msg is not being displayed. Any ideas? sftp $argument <<EOF quit EOF echo "finished" Thanks in advance, :O) (1 Reply)
Discussion started by: alienET
1 Replies

3. UNIX for Advanced & Expert Users

Error Handling in Korn Shell scripts

Hi, I am using few ISQL statements to update and delete from a few tables in sybase, now i want to roll back the transaction when any of the statements fail.How i can i capture these errors in the shell scripts.Please advise. Thanks, Gopi (4 Replies)
Discussion started by: bhgopi
4 Replies

4. Shell Programming and Scripting

Korn Shell Script to find out error in logfile

Hi All, I am new to this forum as well as to unix scripting. Can you please help me to create a korn shell script to find out errors in logfiles and get the name of that logfile ( which is having error) in email and email it to me? (2 Replies)
Discussion started by: jithu
2 Replies

5. Shell Programming and Scripting

Error with korn shell - arrays

Hi All I have a FTP script which FTPs few files into an user folder. I intend to keep track of the folder size before FTP and after FTP and print that once the FTP script is run (a kind of comparison, "Before FTP, "After FTP"). I decided to use kron shells to accomplish this. #! /bin/ksh ... (2 Replies)
Discussion started by: guruparan18
2 Replies

6. Shell Programming and Scripting

SFTP using korn shell

Hi All, I am able to SFTP files using the below command in my script. sftp -b test.bat $user@$IP << EOF i have written the following command in the test.bat file put /home/user1/testfile.txt /ftpdata/out/ quit i am able to sftp the testfile.txt from one server to another. could any... (1 Reply)
Discussion started by: singhald
1 Replies

7. Shell Programming and Scripting

korn shell script executed with error

Hi, need help, I would like to know what is this IF statement trying to do? When the script is executing and error out with line 9 which is the IF statement line. if ] then TOPDIR=$(pwd) else TOPDIR=${0%/*} fi TOPDIR=${TOPDIR%/*} the log file. Current system time is... (15 Replies)
Discussion started by: beooi
15 Replies

8. 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

9. Shell Programming and Scripting

Change text color in Korn shell to highlight Error

Hi this is my first post, so forgive me if what I'm requesting doesn't make sense. I'm connecting into a Unix server via SSH and using a Korn Shell (#!/bin/ksh). The Unix server has Oracle 11g installed on it and there are a number of scripts already setup to query the Oracle database to perform... (2 Replies)
Discussion started by: KeithJ
2 Replies

10. Shell Programming and Scripting

SFTP Scripting and Log capture

Hi All, Need help in below query, appreciate your help. We are changing a FTP process to SFTP ( passwordless SSH ) I had few queries on how to log the transfer details into a log file. ----------------------------------------------------- PUTLOGFILE= /xxx/ftp_log.log FAILPUTLOGFILE=... (0 Replies)
Discussion started by: aadarshtripathi
0 Replies
sftp-server(1M) 					  System Administration Commands					   sftp-server(1M)

NAME
sftp-server - SFTP server subsystem SYNOPSIS
/usr/lib/ssh/sftp-server DESCRIPTION
sftp-server implements the server side of the SSH File Transfer Protocol as defined in the IETF draft-ietf-secsh-filexfer. sftp-server is a subsystem for sshd(1M) and must not be run directly. There are no options or config settings. To enable the sftp-server subsystem for sshd add the following to /etc/ssh/sshd_config: Subsystem sftp /usr/lib/ssh/sftp-server See sshd_config(4) for a description of the format and contents of that file. There is no relationship between the protocol used by sftp-server and the FTP protocol (RFC 959) provided by in.ftpd. EXIT STATUS
The following exit values are returned: 0 Successful completion. >0 An error occurred. FILES
/usr/lib/sftp-server ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWsshdu | +-----------------------------+-----------------------------+ |Interface Stability |Evolving | +-----------------------------+-----------------------------+ SEE ALSO
sftp(1), ssh(1), ssh-add(1), ssh-keygen(1), sshd(1M), sshd_config(4), attributes(5) To view license terms, attribution, and copyright for OpenSSH, the default path is /var/sadm/pkg/SUNWsshdr/install/copyright. If the Solaris operating environment has been installed anywhere other than the default, modify the given path to access the file at the installed location. AUTHOR
Markus Friedl SunOS 5.10 30 Jul 2003 sftp-server(1M)
All times are GMT -4. The time now is 02:32 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy