Sponsored Content
Top Forums Shell Programming and Scripting How to determine whether the FTP was successful or not Post 302364429 by cfajohnson on Friday 23rd of October 2009 03:39:50 AM
Old 10-23-2009
Quote:
Originally Posted by julie_s
Hi,

In a shell script we issue a ftp command to transfer some files, so the shell script process invokes another FTP Process. The ftp session has started but due to some reason the ftp is broken, then how to determine in the script that the file transfer was not successful.
We can make a check after issuing the ftp command like this :

Code:
ftp bla bla
if [ $? -ne 0 ]; then
  echo "File transfer was not successful"
fi

The check for exit status cannot determine whether the file has reached the destination or not. How to determine this in the script.
Can any1 please suggest me how do I go about this?

The ftp command is intended for interactive use, and it doesn't work well in scripts.

For scripting, use the ncftp family of commands.

(Or, if possible, use ssh and scp.)
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Successful Installion of Apache

I finally finished installing Apache on my companies SCO server. The problem was with the way I uncompressed the Apache .tar.z file. I downloaded Apache onto a windows computer on our network. Then I used winzip to uncompress the files. After un- compressing the files, I transferred them to the... (0 Replies)
Discussion started by: cstovall
0 Replies

2. Shell Programming and Scripting

ftp - determine ascii or binary file

Hello, How to i determine via ftp commandline if files on ftp server is ascii or binary files. Like every other comon windows ftp program does it automatically. regards Thomas (5 Replies)
Discussion started by: congo
5 Replies

3. Shell Programming and Scripting

Detemine if SED is successful

Is there a way of finding out if an issued sed command is successful? Basically, in my script I have a command where mydata=$(cat record | sed '...command here...'). When the sed command finds the data that I am after it is assigned to mydata. When the sed command does not find the data I am... (1 Reply)
Discussion started by: gugs
1 Replies

4. UNIX for Dummies Questions & Answers

Test if execution was successful

Hi How can I test inside a shel script whether the last action was successful or not. I have the following line which is executing inside a script . ./runProcess.sh $i $var_num>> error.txt 2>&1 This is occuring in a loop. How can i test whether it was succes for last var_num or not. How... (2 Replies)
Discussion started by: Prashantckc
2 Replies

5. UNIX for Dummies Questions & Answers

How to get successful/unsuccessful FTP logs in UNIX

Hi, We have one UNIX Server (Sun Solaris), and the files coming to this server from another server. The problem is, that server is continously sending files to our server via FTP. But the observation is that some files missing in our Server but in that server it shows the files FTPed... (2 Replies)
Discussion started by: vikash.rastogi
2 Replies

6. Solaris

How to view only successful login?

Hi all, I have to view only success full login attempts . View who are all logged in correctly , and where it can be stored? Thanks in advance Gnanavel (3 Replies)
Discussion started by: Gnanavel
3 Replies

7. UNIX for Advanced & Expert Users

Wether does it successful or unreachable?

Hi, all: How can I check what happen with my own NIC driver which response "successful" when local PC "ping" a remote linux PC but "unreachable" when it "ping" a remote windows XP PC? My writed driver runs in linux 3.0.4 kernel. thanks! li, kunlun (1 Reply)
Discussion started by: liklstar
1 Replies

8. Shell Programming and Scripting

FTP Status check(whether it is successful or not)

Hi Friends I need to check the status of FTP connection i.e. Whether it is successful or not I have tried this by assigning the FTP connection script to a variable and after that using this variable I tried to check the status. In the below code snippet I am trying to assign the FTP... (1 Reply)
Discussion started by: Kannannair
1 Replies

9. UNIX for Dummies Questions & Answers

Ftp - file transfer and check successful delivery

In shell script, I want to transfer files continuously and make sure transfer is successful. Please advise... how to make sure ftp transfer is successful? Also is there any option such as sftp -b where I can pass multiple put <file name> commands to ftp Thanks! (1 Reply)
Discussion started by: vegasluxor
1 Replies
ftp(4)								   File Formats 							    ftp(4)

NAME
ftp - FTP client configuration file SYNOPSIS
/etc/default/ftp DESCRIPTION
Use the ftp file to configure the behavior of the FTP client. Lines that begin with a hash symbol ("# ") are treated as comment lines and are ignored. Behavior Directives The ftp file supports the following behavior directives: FTP_LS_SENDS_NLST=yes | no The ls command of the ftp client sends an NLST to the FTP Server by default. Several non-Solaris clients send LIST instead. In order to make the Solaris ftp client send LIST when the ls command is issued, set FTP_LS_SENDS_NLST to no. The value of FTP_LS_SENDS_NLST is yes by default. If the user sets a value for FTP_LS_SENDS_NLST in the user's environment, this value will override any FTP_LS_SENDS_NLST directive that is specified in /etc/default/ftp. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWbipr | +-----------------------------+-----------------------------+ SEE ALSO
ftp(1), attributes(5) SunOS 5.11 22 Oct 2002 ftp(4)
All times are GMT -4. The time now is 03:02 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy