FTP Error Message


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting FTP Error Message
# 1  
Old 08-01-2011
FTP Error Message

Hello All

I have below code snippet

Code:
/usr/bin/ftp -niv $ftphost 1>&2 >> $upload_log <<EndFtp
  quote user $ftp_user
  quote pass $ftp_pass
  cd $ftp_dir
  put $upload_file

When i pass a wrong ftphost as a paramater, output is "ftp: abc.net: Name or service not known". (abc.net is the wrong server name which i have passed ). But this output is not being redirected to upload_log file instead it is getting dispalyed on the terminal. If incorrect credentials are passed, then they are redirected to upload_log file.

Is there any way to check the status of the transfer. If transfer fails, i wish to send an email. But how can i check whether transfer failed or not. As far as i know, exit status is always 0 from ftp whether it fails to transfer or not. Please provide me a solution on this.

Appreciate your help in advance

Last edited by radoulov; 08-01-2011 at 05:47 PM.. Reason: Code tags!
# 2  
Old 08-01-2011
The usual and recommended form for logs is "command arg1 arg2 arg3 >> log_file 2>&1". The order is important, as you can redirect a cross between what was stdout media and stderr media. "1>%2" is same as ">&2", says put stdout to the stderr device (tty?) first, and then you try to direct it to a file (who wins?) I trust you are in the right local dir, as you did no lcd, perhaps did a cd outside ftp above?
# 3  
Old 08-01-2011
Thanks.

Redirection was working now.

But is there any way find out whether FTP worked successfully or failed during file transfer. Can we check the status of FTP Transfer.
# 4  
Old 08-02-2011
I believe ftp exit( not zero) if problem, but the man page is silent.

I like to find an end to end sort of solution, like listing files pushed using ftp ls or pulled using shell ls -l, making sure files pulled are not empty, are complete (how to tell depends on file type).
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

What does this error message mean?

I was reviewing logs and I got this error message in /var/log/messages: Did not receive identification string from (IP ADDRESS) What does it mean? (6 Replies)
Discussion started by: mojoman
6 Replies

2. UNIX for Dummies Questions & Answers

Error Message

I keep getting an error message in a script im writing, this line is allways pointed out. if and this is the message i keep getting. line 32: [: 8: unary operator expected Whats wrong with it? Please Help. (5 Replies)
Discussion started by: chapmana
5 Replies

3. UNIX for Dummies Questions & Answers

Error Message

What does this means? - ERROR OPENING FILE - KEY LENGHT MISMATCH (2 Replies)
Discussion started by: RDM00
2 Replies

4. Shell Programming and Scripting

trnsmiting thousands ftp files and get an error message

Im transmiting thousands ftp files to a server, when type the command mput *, an error comes and say. args list to long. set to I. So ihave to transmit them in batch or blocks, but its too sloww. what shoul i do?. i need to do a program, or with a simple command i could solve the problem? (3 Replies)
Discussion started by: alexcol
3 Replies

5. Shell Programming and Scripting

Error message

I am new to scripting. I am using the following script . BART.dat contains the string 'Y' . #!/bin/ksh cd /work/TCI/data_out file=`cat BART.dat` echo "$file" if ; then echo "true" fi When i am executing the above script i am getting the following error ./s.ksh: : not found ... (2 Replies)
Discussion started by: ammu
2 Replies

6. UNIX for Advanced & Expert Users

error message

I get this error message as soon as i log in -bash: /usr/local/software/.../vni/CTT6.0/ctt/bin/lopt64.sh: No such file or directory I looked into the etc/profile but there are no lines sourcing this file. And there is no lopt64.sh in the directory vni/.../bin I couldn't fogure out what... (4 Replies)
Discussion started by: dsmv
4 Replies

7. Shell Programming and Scripting

FTP Warning message ?

Hi, I wrote a ftp script to get some files from one server. So files transer is working properly. But I observed following Warning message for every transaction, Can somebod give me explanation to this Warning message? I am confused? 109516 bytes received in 0.066 seconds (1659333 bytes/s)... (1 Reply)
Discussion started by: maheshsri
1 Replies

8. Solaris

Error message

Hi, My Solaris 5.8 system keeps getting this error at boot - "Can't set vol root to /vol" then /usr/sbin/vold: can't set vol root to /vol: Resource temporarily unavailiable Any idea what is wrong, and how do I fix it? (0 Replies)
Discussion started by: ghuber
0 Replies

9. UNIX for Dummies Questions & Answers

Ftp welcome message

Hi there Could anyone tell me if it's possible, and if it is, how to setup a welcome message on my ftp server? i've readed the man pages for ftp,ftpd,ftpaccess and came to no conclusion. this on HP-UX. thanks for any help (2 Replies)
Discussion started by: vascobrito
2 Replies

10. UNIX for Advanced & Expert Users

Error message

I'm getting an error - symbol referencing errors. No output written to, etc Can anybody tell me why this is? (2 Replies)
Discussion started by: Dan Rooney
2 Replies
Login or Register to Ask a Question