LinuxQuestions.org
Help answer threads with 0 replies.
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 02-20-2004, 04:07 PM   #1
Paulo Ges
Member
 
Registered: Feb 2003
Location: Rio de Janeiro - Brazil
Distribution: Slackware 11
Posts: 30

Rep: Reputation: 15
Connection, login and upload files to ftp server via shell script


In my network there are:

Machine A (ftp server running ProFTPd)
Machine B

In Machine B, at /root, there is .netrc file that controls successfully auto-login to Machine A. From the command line the connection and login are fine, but how can I do to, via shell script, execute the connection, login and upload some files as I do interactively in command line?

Thanks in advance
Paulo Ges
 
Old 02-21-2004, 01:25 PM   #2
linuxxed
Member
 
Registered: Feb 2004
Posts: 273

Rep: Reputation: 30
Re: Connection, login and upload files to ftp server via shell script

Quote:
Originally posted by Paulo Ges
In my network there are:

Machine A (ftp server running ProFTPd)
Machine B

In Machine B, at /root, there is .netrc file that controls successfully auto-login to Machine A. From the command line the connection and login are fine, but how can I do to, via shell script, execute the connection, login and upload some files as I do interactively in command line?

Thanks in advance
Paulo Ges
1)One way is to write like this.

ftp server<<EOF

ftp command 1
ftp command 2
.......
bye
EOF

There shouldn't be iany leading space before the last EOF. You can use any string in place of EOF.

2) Second way is

(ftp command1 ; sleep 1; ftp command 2 ; sleep 1; ftp command 3; sleep 1 )| ftp server



This should work fine . Note the "sleeps" .. they are added to give the server some time to respond. The only problem is it sends it as a bunch to the server and if the server is slow then it may not work correctly(1%).

3) Third way is to use TCL expect. Expect allows you to automate anything. It's brilliant.
 
Old 02-21-2004, 02:01 PM   #3
dominant
Member
 
Registered: Jan 2004
Posts: 409

Rep: Reputation: 30
Try to do your job using perl is pretty simple with Net::FTP module!
 
  


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
How to Shell Script auto ftp connection? mtn356 Linux - General 4 03-18-2004 08:31 PM
Running FTP inside Shell Script truncates files jbhanc0125 Red Hat 3 01-16-2004 12:37 PM
Can login to WU-FTP server but cannot upload friddick Linux - Networking 0 08-21-2003 10:00 AM
Can login to WU-FTP server but cannot upload friddick Linux - Networking 0 08-21-2003 10:00 AM
Shell File Upload Monitor Script noodle123 Programming 0 04-22-2002 12:36 PM


All times are GMT -5. The time now is 12:02 AM.

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