Executing statements after quit in FTP.


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Executing statements after quit in FTP.
# 1  
Old 12-05-2003
Executing statements after quit in FTP.

In my shell script I am doing FTP along with other process. But all the statements after the "quit" command in FTP are not getting executed.

Example:
echo "This is a shell script to FTP a file"
#ftp -inv <server name> <<eol>> <logfilename>
#user <userid> <password>
#put <filename>
#quit
echo "FTP Done. Check for the file"|mailx -s "FTP" <mail-id>

In the above shell scrpt, I am getting the first echo
i.e., "This is a shell script to FTP a file"
but not sending mail which is statement after "quit".
I think it is coming out of the program with the "quit".

Can any one suggest how to achieve this.

Thanks
# 2  
Old 12-05-2003
It appears you are missing the closing tag eol. In the example below, I use the tag ENDFTP.

ftp_func () {
ftp -v -n $TO_HOST << ENDFTP >> $LOGFILENAME
user $USERNAME $PASSWORD
ascii # or binary depending on what your file type is
prompt off
hash on
lcd $FILE_DIR #Optional if you want to go to a specific dir
get $FILE_NAME #get or put, your choice
bye
ENDFTP
}

echo "Calling the ftp function"
ftp_func
echo "FTP Done. Check for the file"|mailx -s "FTP" <mail-id>
# 3  
Old 12-05-2003
hi google
thatsfine
i tried with closing tag
itzz fine working

Cheeers
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Executing statements inside forloop parallely

Hi All, I have made a forloop as given below. if ]; then echo -e "serv_AAA_DS.ldif file created and will be splitted into 8 smaller files for ldapadd \n" sh ./file_splitter.sh for (( w=1; w <= 8; ++w )) do nohup ldapadd -x -c -h PL0 -p 389 -D "$LDAP_USER" -w... (8 Replies)
Discussion started by: Kamesh G
8 Replies

2. Red Hat

FTP stuck in 150 ascii after executing command

Hi, We have 2 linux RH servers (Server A and Server B), that were configured the same way. Same OS version, same ftp client, etc. The ftp client that we had installe, was downloaded from rpmbone site and the filename is: ftp-0.17-53.el6.x86_64 The permissions were already set up... (1 Reply)
Discussion started by: cees09
1 Replies

3. Shell Programming and Scripting

Commands not executing after FTP in shell script

Hello In the shell script we have a FTP command like below ftp -n -v -q winftp.principal.com >/infa/datafiles/GRP/Scripts/ftp_from_infa_dvcn.log<<END_SCRIPT   quote USER $FTP_USER quote PASS $FTP_PASS ascii lcd $FTP_LOCALDIR cd $FTP_FLDR put $FTP_FILE   bye exit If i... (1 Reply)
Discussion started by: Pratik4891
1 Replies

4. Shell Programming and Scripting

Quit FTP issue

Hey, same problem. i want to check if files have been successfuly transferred after getting them back, but after I quit the ftp, nothing gets executed. Difference from original post is that I get 226 and 221 feedbacks from the server. 226 Transfer complete. 2409 bytes received in 0.0086... (5 Replies)
Discussion started by: fpflug
5 Replies

5. Shell Programming and Scripting

FTP script - 'quit' never executes

I have wrote a script to get a very large encrypted file from a remote ftp server to a local debian box. The file downloads successfully, but the script never exits, or quits. None of code executes after the ftp get command. The file is approx 291M Here is the code: !/bin/sh... (3 Replies)
Discussion started by: jstrahm
3 Replies

6. UNIX for Dummies Questions & Answers

If FTP cron job fails to connect = quit

Im having a problem with my ftp CRON jobs. I have another related (but not the same question in shell scripting). My FTP CRON jobs connect to a server and drop some files off, if for some reason it cannot connect to the server (timesout/password wrong etc) instead of stopping, it tries again... (3 Replies)
Discussion started by: mokachoka
3 Replies

7. Shell Programming and Scripting

executing commands through FTP session

Dears, i want to execute unix commands through FTP session those commands like grep XXXXX file name > new file tar new file ..... etc Please let me know how to so thank you (3 Replies)
Discussion started by: faiz
3 Replies

8. UNIX for Advanced & Expert Users

Executing shell script from Windows FTP

Hello, Any inputs on the possibility of executing a shell script on unix box from Windows FTP TIA (1 Reply)
Discussion started by: B2BIntegrator
1 Replies

9. UNIX for Dummies Questions & Answers

FTP - Executing Commands

I have written a script to ftp a file from Unix to an NT machine to authenticate ftp login I have added the information into the .netrc file when logged in using ftp the commands are not executed. Does anybody know how to make the command execute once username and password have been provided using... (2 Replies)
Discussion started by: hesmas
2 Replies
Login or Register to Ask a Question