Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 10-15-2002, 05:33 PM   #1
LQ Newbie
Registered: Apr 2002
Posts: 27

Rep: Reputation: 15
FTP Script (Automating)

I'm trying to automate an ftp script so that it ftp's to various servers (rs001, rs002, rs003....) and send a file... and no, RCP won't work in my case.

But here's my script so far.

STORES="001 002 003 004 005"

for store in ${STORES}
ftp rs${store} <<ENDFTP
send file1

Now for some reason the script won't work and keeps giving this same error msg. "syntax error: unexpected end of file"

can't someone help me with this?

Note: I didn't use ftp -n because i don't need to enter password/user since when i use "ftp rs001" the login is automated already. Any help much appreicated.
Old 10-16-2002, 03:09 AM   #2
Senior Member
Registered: Aug 2002
Location: Stuttgart (Germany)
Distribution: Debian/GNU Linux
Posts: 1,467

Rep: Reputation: 46
An example script of an FTP GET ... all you need to do is to convert that to STORE (and adjust user-details of course):

cd /backups/databases
ftp -n hostname <<EOF
user username password
cd /databases
get databases_2002-10-15@00-00.tar.bz2
dele databases_2002-10-15@00-00.tar.bz2

cd /backups/webserver
ftp -n hostname <<EOF
user username password
cd /htdocs
get webserver_htdocs-2002-10-15.tar.bz2
dele webserver_htdocs-2002-10-15.tar.bz2
Oh and like trickykid said please DO NOT DOUBLE-POST! It's just annoying doing so!
Old 10-16-2002, 09:17 AM   #3
LQ Newbie
Registered: Apr 2002
Posts: 27

Original Poster
Rep: Reputation: 15
sorry for the double post, but the first post i think i buggered up cuz i hit 'back' by mistake. But the script above needs to be in a loop. I can make it do a one time get/send but i need to use the ftp script within a loop. Everytime i put it in a for loop it gives me unexpected end of file error which i don't know where it's coming from.

edit: i have about 100 different ftp servers i need to ftp ONE file to, so having the server (store) ips within a file it'll be quicker to have the script loop back rather than having 100 independent ftp gets.

Last edited by noodle123; 10-16-2002 at 09:19 AM.


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Automating the "killing" process via a shell script fatrandy13 Linux - Software 5 09-14-2007 12:59 AM
automating lynx in a shell script yimboli Programming 15 04-04-2007 03:15 AM
Trouble when automating ftp with shell script hari_s_82 Linux - Newbie 2 09-23-2004 03:17 AM
Automating a playlist using shell script... DesiLILO Linux - Newbie 4 04-03-2004 12:03 AM
Automating an ftp and mail job saavik Linux - Networking 12 07-09-2002 06:22 AM > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 01:27 PM.

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