ftp exits....


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users ftp exits....
# 1  
Old 11-22-2005
ftp exits - stuck....

Hi ,
I am facing a strange problem in my code...
I have written a shell script to automate ftp using .netrc file
here is the portion of code

ftp -i ${DomainName} 2>ftp_err.tmp 1>myfile <<_EOF_
bin
cd "${SourceDirectory}"
lcd "${InputDirectory}"
get "${InputFileName}"
bye
_EOF_

and the problem is
Sometimes it exits without any failure message after running for a long time...
even the the script also gets terminated , i.e the code after this also is not getting executed..

any idea... it seems that ftp is getting stucked... and nothing is working

anything is appreciated
Shihab

Last edited by shihabvk; 11-25-2005 at 01:58 AM..
# 2  
Old 11-24-2005
When I write scripts using .netrc, the scripts follow a specific .netrc syntax that does not look like your core. Perhaps you can get clues from the .netrc man page?

Code:
NETRC(5)                  System File Formats Manual                  NETRC(5)

NAME
     netrc, .netrc - user configuration for ftp

DESCRIPTION
     This file contains configuration and autologin information for the File
     Transfer Protocol client ftp(1).

     The .netrc file contains login and initialization information used by the
     auto-login process.  It resides in the user's home directory.  The fol-
     lowing tokens are recognized; they may be separated by spaces, tabs, or
     new-lines:

     machine name
               Identify a remote machine name.  The auto-login process
               searches the .netrc file for a machine token that matches the
               remote machine specified on the ftp command line or as an open
               command argument.  Once a match is made, the subsequent .netrc
               tokens are processed, stopping when the end of file is reached
               or another machine or a default token is encountered.

     default   This is the same as machine name except that default matches
               any name.  There can be only one default token, and it must be
               after all machine tokens.  This is normally used as:

                     default login anonymous password user@site

               thereby giving the user automatic anonymous ftp login to
               machines not specified in .netrc.  This can be overridden by
               using the -n flag to disable auto-login.

     login name
               Identify a user on the remote machine.  If this token is pre-
               sent, the auto-login process will initiate a login using the
               specified name.

     password string
               Supply a password.  If this token is present, the auto-login
               process will supply the specified string if the remote server
               requires a password as part of the login process.  Note that if
               this token is present in the .netrc file for any user other
               than anonymous, ftp will abort the auto-login process if the
               .netrc is readable by anyone besides the user.

     account string
               Supply an additional account password.  If this token is pre-
               sent, the auto-login process will supply the specified string
               if the remote server requires an additional account password,
               or the auto-login process will initiate an ACCT command if it
               does not.

     macdef name
               Define a macro.  This token functions like the ftp macdef com-
               mand functions.  A macro is defined with the specified name;
               its contents begin with the next .netrc line and continue until
               a null line (consecutive new-line characters) is encountered.
               If a macro named init is defined, it is automatically executed
               as the last step in the auto-login process.

SEE ALSO
     ftp(1), ftpd(8)

# 3  
Old 11-28-2005
Hi ,
My .netrc file is like this..
machine hello.world.com login mylogin password hihi
machine temp.tmp.com login mylogin password etcetc


The major problem I am facing is it is simply exiting .. the control is not even coming to the next line of code..
Any method to catch this error.. I just want to know what happened...
means just want to catch up the error...

please help me...

Regards
Shihab
# 4  
Old 11-28-2005
try using both the "-n" and the "-v" options (see "man ftp") and check what your logs say ... i'm thinking there is an authentication issue that times out on one of your servers but you wouldn't know that without getting any logged outputs ...

Code:
ftp -inv ${DomainName} 2>ftp_err.tmp 1>myfile <<_EOF_
bin
cd "${SourceDirectory}"
lcd "${InputDirectory}"
get "${InputFileName}"
bye
_EOF_

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Script to check if files exits

Hi In live system core files are generating frequently. around 10 core files in 30 mins in root file system. which is eating my space very much below is core file core.56539 core.78886 core.12302 core.80554 core.20147 I am trying to write a script which should move... (7 Replies)
Discussion started by: scriptor
7 Replies

2. Shell Programming and Scripting

Script exits when using UNIX2dos / dos2UNIX

I'm not sure why but my script quits automatically at the point where unix2dos / dos2unix command is used. :confused::confused::confused: How do a fix it? LOG_FILE=MADDY.txt unix2dos ${LOG_FILE} exec 2> $LOG_FILE 1>&2 echo ${LOG_FILE} The script exists after the below... (3 Replies)
Discussion started by: machomaddy
3 Replies

3. Shell Programming and Scripting

Execute a command after ssh exits

In my .tcshrc I define and run an alias to set my terminal title. The title contains the hostname. I do this because I ssh to other machines a lot and I always need to know which host I am typing in. The alias is defined and run in the .tcshrc like this... alias tt 'echo -n "^0;`hostname -s`^G"'... (5 Replies)
Discussion started by: salvadorjoshua
5 Replies

4. Shell Programming and Scripting

Code exits before completing

The lines in bold check the value of a user input, if it is not one of the expected genes (GJB2, MECP2, PHOX2B), the user is shown a list of formats to use and the variant is entered. It is then supposed to printf that entered variant? Thank you :). name() { printf "\n\n" printf... (2 Replies)
Discussion started by: cmccabe
2 Replies

5. Shell Programming and Scripting

Grep for string and substitute if exits with a yes/no

Hi I have 3 files in total. file 1 is enriched.txt file2 is repressed.txt and file 3 is my content.txt What i need is query the content file against both enriched and repressed and wherever the gensymbol is same in both the files then add a yes value against it file1 Gene ABC XYZ MNO... (12 Replies)
Discussion started by: Diya123
12 Replies

6. Shell Programming and Scripting

Check when user exits SUDO

Hello to everyone, I'm new here and would like to thank everybody for the upcoming support, I know that I will have my question answered here, this community is huge. :) First of all, I´m a DBA and work on a daily basis on Unix environments of all kinds (HP-UX, Solaris, AIX, etc). I have... (8 Replies)
Discussion started by: ZeroBR
8 Replies

7. Shell Programming and Scripting

how to run a command as soon as user exits from session

I need to write a script, where I have to get names of files that are to be deleted from a user and have to delete those files when he exits session. How to set a particular command to be run as soon as user exits from a session? Can somebody help? I have to write a script on linux system.... (3 Replies)
Discussion started by: yashashri
3 Replies

8. Shell Programming and Scripting

'script' command exits immediately

I'm trying to capture the output of some commands with the 'script' utility. Normally, I would type 'script /path/to/output/file', then enter commands, then hit ctrl+D to end the 'script' capture. I'm having trouble with it on a server. Upon starting 'script', it exits immediately before I type... (6 Replies)
Discussion started by: jalburger
6 Replies

9. Shell Programming and Scripting

Exits from putty instead of shell script

Dear, I have written below code to initiate the log at top of my script. #Set the log file LOGFILE=<path>/<filename.log> exec > $LOGFILE 2>&1 ............... .... ... .. ............ echo -e "\n\n Script finished OK " `date "+%m/%d/%y %H:%M:%S" ` "\n\n" exit 0 the logging ends only... (14 Replies)
Discussion started by: Imran_Chennai
14 Replies

10. Shell Programming and Scripting

Background program exits prematurely?

Hello! I am currently attempting to build a very, very, basic program that attempts to act like a calendar for a "server." Using this program I need to have the client program connect to the server program, have the client wait for the server to respond through a socket, then exit and the server... (2 Replies)
Discussion started by: Entelexia
2 Replies
Login or Register to Ask a Question