LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 03-23-2006, 11:24 AM   #1
pshankland
Member
 
Registered: Feb 2006
Location: UK
Distribution: CentOS 5.5
Posts: 46

Rep: Reputation: 15
Scripting FTP Help


I am trying to script FTP so I can take a .tar file that I created and ftp it through to a Windows FTP server.

I have the following line in the script I created to create the tar file:

Code:
FTP < /scripts/ftpscript
And then in ftpscript I have:

Code:
open xxx.xxx.xxx.xxx
<username>
<password>
put *.*
bye
Problem is that this all works but the script just sits there waiting for a password.

Any ideas?

Thanks.
 
Old 03-23-2006, 01:55 PM   #2
jjohnston62
Member
 
Registered: Aug 2003
Location: Minnesota, USA
Distribution: RedHat, Suse
Posts: 106

Rep: Reputation: 15
scripted ftp........

Include ftp commands within the script, and process them with ftp -n

for example:

HOST='site.domain.com'
USER='username'
PASSWD='secret'
ftp -n $HOST
quote USER $USER
quote PASS $PASSWD

include all that in a shell script, and then execute your put $FILE command.

don't try to run the script through FTP
 
Old 03-24-2006, 02:46 AM   #3
pshankland
Member
 
Registered: Feb 2006
Location: UK
Distribution: CentOS 5.5
Posts: 46

Original Poster
Rep: Reputation: 15
Thanks. Have now got the following just in my shell script:

Code:
FTP_HOST=172.xxx.xxx.xxx
FTP_USER=username
FTP_PASS=password

ftp -n $FTP_HOST
quote USER $FTP_USER
quote PASS $FTP_PASS
put $BACKUP_FILE
bye
But just get the script sitting at:

Code:
2200 <FTPSERVER> Microsoft FTP Service (Version 5.0).
ftp>
And I have to manually type quit to end the script without it finishing.

Pete.
 
Old 03-24-2006, 05:06 AM   #4
nx5000
Senior Member
 
Registered: Sep 2005
Location: Out
Posts: 3,307

Rep: Reputation: 57
Code:
#!/bin/sh
ftp -n web.site.com << EOF
user foo foo_password
cd /some/dir
bin
mget some_file
bye
EOF
Should work. It does for me
 
Old 03-24-2006, 06:07 AM   #5
pshankland
Member
 
Registered: Feb 2006
Location: UK
Distribution: CentOS 5.5
Posts: 46

Original Poster
Rep: Reputation: 15
Cheers nx5000, that worked fine
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Scripting and FTP ceaseless Linux - Newbie 14 01-13-2006 01:45 AM
FTP Server Up and running... how do I hide ftp users from local login screen? joe1031 Mandriva 2 03-18-2005 04:24 PM
ftp scripting doctorwebbox Linux - General 7 01-21-2005 12:01 PM
problem with ftp on mandrake 10.1 Official, ftp speeds system wide (anybody noticed?) equinox Mandriva 15 11-10-2004 02:07 PM
Scripting of routine ftp download BioHak Linux - Newbie 0 03-02-2003 08:17 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 10:04 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration