trapping sftp errors


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting trapping sftp errors
# 1  
Old 08-05-2009
trapping sftp errors

I'm trying to trap errors in a shell script executing an sftp command this way:

/usr/bin/sftp $FTP_USER@$FTP_SERVER <<EOF> $HOME/$ERR_FILE
cd $FTP_DIR
put $FILE_NAME
bye
EOF

I expect errors to be recorded in $ERR_FILE but they are not. The only thing in the $ERR_FILE is:
sftp> sftp> sftp>

Thank you
# 2  
Old 08-05-2009
Errors might be printed to standard error instead of standard output, try 2> instead of >
# 3  
Old 08-05-2009
Thanks!

I made the change you suggested and that did it. Thanks a lot.Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Error Trapping

Hi, I have one shell script as below while read SegList do if test -s ${SourceFile_Path}/${Segment_List_Temp} then ls -r -1 ${FTP_Path}/${SegList}.DAT.${Datelist}.GZ|cut -d '.' -f2>>${SourceFile_Path}/${List_Temp} echo "IF above statment Fail I want to Create Emtpy File How to Trapp... (3 Replies)
Discussion started by: samadhanpatil
3 Replies

2. Shell Programming and Scripting

Need help to handle errors during SFTP

Hi, I have written a script that sftp's files from linux box to a IBM machine. Can anybody help me how to handle any errors during SFTP file transfer. I am writing the SFTP commands onto a file and executing that as you can see below. while read line do if ] && ]; then echo "put... (1 Reply)
Discussion started by: ramkiran77
1 Replies

3. Shell Programming and Scripting

trapping errors from a sub call

I want to trap any errors from a backup database script and send an email when an error occurs. I can trap command errors and send an email in the following code. My problem occurs if an error occurs in the Maxl script, /opt/hyperion/AnalyticServices/bin/essmsh < MaxlScript.msh..., that is called... (0 Replies)
Discussion started by: t_coop
0 Replies

4. UNIX for Dummies Questions & Answers

trapping errors

I am using unixs script to submit programs (SQRS) and need to trap any time of error that is received once the job finishes. Examples of the type of errors I am getting Error! SQR Failed To Process mkdir: Failed to make directory These are showing up in a log file but I do not want to... (3 Replies)
Discussion started by: TimHortons
3 Replies

5. Shell Programming and Scripting

Trapping $! output

hey all, I have a script that creates and then distributes html files via scp on a 60 second cycle. On occasions the scp will hang and not complete with the cycle. When running the scp command in the back ground it returns the PID. How do I trap $! in the script? job=`echo $!` returns... (2 Replies)
Discussion started by: nhatch
2 Replies

6. HP-UX

Trapping the rm command in UNIX

Hi All, Whoever types rm in the command prompt I need to trap the username, the ip address,timestamp and the rm filename(which file they are removing) and write it to the log file. could anyone help me?. Advanced thanks Suma (1 Reply)
Discussion started by: sumas
1 Replies

7. Shell Programming and Scripting

trapping errors while using FTP.

Hello, I have the following shell script to perform ftp: ftp -n $HOST<<EOD quote USER $USER quote PASS $PASS lcd $outputd cd $dir binary put *.zip quit EOD If any error is generated from this script then how to trap the error. For ex: let's say we entered wrong password then the... (5 Replies)
Discussion started by: radhika
5 Replies

8. Shell Programming and Scripting

Error Trapping

Hi, Can anybody tell me how to error trap an empty line. If i am asked for a password and I hit enter without entering any text, how do i display an error? Thanks Kev (6 Replies)
Discussion started by: kev112
6 Replies

9. Shell Programming and Scripting

PERL: Trapping EXIT

Hey Everyone, Just starting with PERL (5.8.2) after years of KSH. Is there a way to trap the exit as you can in KSH (i.e., "trap EXIT_SCRIPT EXIT")? Thanks in advance for any help, gsatch (4 Replies)
Discussion started by: gsatch
4 Replies

10. UNIX for Dummies Questions & Answers

trapping keys

how do i trap enter command entered by a user. actually i am throwing a screen this screen has no input but this screen should be displayes unless and until the user presses the enter key. as the user presses enter key the command prompt should come. how do i achieve this (1 Reply)
Discussion started by: sunil bajaj
1 Replies
Login or Register to Ask a Question