The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Problem to auto mount on NFS server blesets Ubuntu 5 11-10-2007 11:01 PM
su auto run help Ehab UNIX for Dummies Questions & Answers 3 09-24-2007 08:46 AM
Auto FTP from UNIX to Windows Server songtam High Level Programming 1 04-07-2006 07:26 AM
auto run whatisthis Shell Programming and Scripting 1 11-24-2004 07:12 PM
Sun solaris server auto reboots mnjanje UNIX for Dummies Questions & Answers 3 01-23-2002 09:50 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 03-17-2006
systemali systemali is offline
Registered User
  
 

Join Date: Feb 2006
Posts: 47
Auto FTP to a server

Hi,

I am trying to automate FTP login to a remote server and put a file there. But no matter what i do, It still is aksing me for the login and password although i have it defined in the variable.

Quote:
SERVER=123.456.789
USER=root
PASSWD=password


if [ $# -eq 0 ]
then
echo "Usage ./ftp.sh <file name>"
exit 0
fi

ftp $SERVER
user $USER $PASSWD
cd /usr/local/home/abc
binary
put testfile

wait
exit 0
Could you tell me what is wrong with this script. I am doing this on SUN server.

Pls assist.

Thanks
  #2 (permalink)  
Old 03-17-2006
vino's Avatar
vino vino is offline Forum Staff  
Supporter (in vino veritas)
  
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,796
All those ftp commands should be within a here-document. Or use the co-process technique.

You should find them in the FAQ section.
  #3 (permalink)  
Old 03-17-2006
systemali systemali is offline
Registered User
  
 

Join Date: Feb 2006
Posts: 47
Thank you so much VINO as always, you have been very helpful

3 cheers to you !
  #4 (permalink)  
Old 03-17-2006
systemali systemali is offline
Registered User
  
 

Join Date: Feb 2006
Posts: 47
One more thing vino,

If i need to read the codes for FTP how can i do that ..for example

Quote:
220 svpkg1-nd FTP server () ready.
331 Password required for admin1.
230 User admin1 logged in.
250 CWD command successful.
200 PORT command successful.
550 tatu: No such file or directory.
221 Goodbye.
I need to validate on code 550 and echo a message that the specified file was not found.

How can we do this.

Thanks once again
  #5 (permalink)  
Old 03-17-2006
vino's Avatar
vino vino is offline Forum Staff  
Supporter (in vino veritas)
  
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,796
Search the forum with the keywords "ftp result code". You will find a couple of posts which will help you out.
  #6 (permalink)  
Old 03-21-2006
Dhruva's Avatar
Dhruva Dhruva is offline
Registered User
  
 

Join Date: Mar 2006
Location: India
Posts: 255
I have ready script

I have automated that FTP script few days back and i think ur requirements are almost same...if ur prob is not yet solved will give u that script
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 05:10 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0