LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
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.

Notices

Reply
 
Search this Thread
Old 10-15-2002, 04:33 PM   #1
noodle123
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}
do
ftp rs${store} <<ENDFTP
send file1
bye
ENDFTP
done

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, 02:09 AM   #2
markus1982
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):
Code:
#!/bin/sh

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

cd /backups/webserver
ftp -n hostname <<EOF
user username password
binary
cd /htdocs
get webserver_htdocs-2002-10-15.tar.bz2
dele webserver_htdocs-2002-10-15.tar.bz2
EOF
Oh and like trickykid said please DO NOT DOUBLE-POST! It's just annoying doing so!
 
Old 10-16-2002, 08:17 AM   #3
noodle123
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 08:19 AM.
 
  


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 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-13-2007 11:59 PM
automating lynx in a shell script yimboli Programming 15 04-04-2007 02:15 AM
Trouble when automating ftp with shell script hari_s_82 Linux - Newbie 2 09-23-2004 02:17 AM
Automating a playlist using shell script... DesiLILO Linux - Newbie 4 04-02-2004 11:03 PM
Automating an ftp and mail job saavik Linux - Networking 12 07-09-2002 05:22 AM


All times are GMT -5. The time now is 02:56 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration