LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 11-21-2005, 01:19 AM   #1
rblampain
Senior Member
 
Registered: Aug 2004
Location: Western Australia
Distribution: Debian 11
Posts: 1,310

Rep: Reputation: 53
learning ftp upload


I have a hosted site I use for backup. I am completely new to this and ftp. The first time I backed up this way, I used the hosting company's ftp interface which worked well but was very tedious.

Now I am trying to follow a tutorial found on the web but it doesn't work, I can see a message about directories before the screen disappears and there is no log to refer to.

I tried to hold on to the screen by removing "bye" but it doesn't help and, doing "man ftp", I can't see anything to pause the process in the available commands (so that I could read the screen).

Here is the script I use:
#!/bin/bash
# backup first
cp -ruv * /mnt/www/html/0/
# then upload it
ftp -v < zftp

zftp
open www.mydomain.net
username
cd www
cd html
cd 0
binary
mput *
bye

Also: is there a way to upload directories recursively? Can't see anything like it in the commands.
Anyone with a suggestion?

Thank you for your help.
 
Old 11-21-2005, 02:48 AM   #2
rtg
Member
 
Registered: Aug 2005
Location: Ukraine
Distribution: Ubuntu 9.04
Posts: 99
Blog Entries: 3

Rep: Reputation: 19
Use lftp (http://lftp.yar.ru/) - it has a nice command line interface and built-in functionality for mirroring of site.
 
Old 11-22-2005, 04:28 AM   #3
rblampain
Senior Member
 
Registered: Aug 2004
Location: Western Australia
Distribution: Debian 11
Posts: 1,310

Original Poster
Rep: Reputation: 53
Thank you rtg, I'll try that.
 
Old 11-23-2005, 03:18 AM   #4
rblampain
Senior Member
 
Registered: Aug 2004
Location: Western Australia
Distribution: Debian 11
Posts: 1,310

Original Poster
Rep: Reputation: 53
I've tried lftp but without success so far, the tutorial explains how to define the username, I can "lftp" with the username successfully.

The tutorial also explains how to create a command line that mirror my site from my machine to the hosted site I have, this does not work, the connection fails and I assume it's because the (fixed) user name given by the hosting company is not the same username that my machine is using.

If I try a combination of both (-u username -c 'mirror.....) then the -c switch gives problems.

Here is the command line I thought I should use:
lftp -u username -c 'open -e "mirror /www/html/ /var/www/html/" ww.hostingcompany.net'

Any hint most welcome.
 
Old 11-23-2005, 01:43 PM   #5
rtg
Member
 
Registered: Aug 2005
Location: Ukraine
Distribution: Ubuntu 9.04
Posts: 99
Blog Entries: 3

Rep: Reputation: 19
First of all for simplicity create a file, say 'commands.txt', to be called as lftp -f commands.txt
Code:
 open ftp://www.yourdomain.com
 user LOGIN PASSWORD
 mirror -R SOURCE DESTINATION
This will open the connection (using ftp protocol, lftp can handle many of them despite of the name), log in to the server using LOGIN and PASSWORD, will change the current working dir to www/html/0 and will mirror the local files to the remote host ( -R for 'reverse').
The shorthand for both connection and supplying the password is
Code:
open ftp://USERNAME:PASSWORD@www.yourdomain.com
But you may modify the script from your first post as follows in order not to use the intermediate file:
Code:
#!/bin/bash
# backup first
cp -ruv * /mnt/www/html/0/
# then upload it
lftp -c 'open ftp://LOGIN:PASSWORD@www.yourdomain.com; mirror -R . /www/html/0';
This script will upload the files recursively from the current directory ( . ) to /www/html/0.

Last edited by rtg; 11-23-2005 at 01:47 PM.
 
Old 11-23-2005, 05:35 PM   #6
number9
Member
 
Registered: Dec 2003
Location: Fresno
Distribution: Gentoo Ricer
Posts: 85

Rep: Reputation: 15
[plug]
ncftp
[plug /]
 
Old 11-24-2005, 09:56 PM   #7
rblampain
Senior Member
 
Registered: Aug 2004
Location: Western Australia
Distribution: Debian 11
Posts: 1,310

Original Poster
Rep: Reputation: 53
Thank you rtg, it's working fine now.

The only problem I have is that I get a lot of messages
**** data-socket: Connection reset by peer
....... delaying before reconnect xxx
I assume the hosting company thinks I am uploading too much and wants to slow me down.

I have uploaded some 20MB and this took about 24 hours on a 256/64 ADSL line.

Since this is done only once, it's not important as long as I am not doing the wrong thing.

Thanks to number9 for the suggestion, I'll have a look at it but I'll use lftp initially for the first upload at least since it's currently doing it.
 
Old 11-25-2005, 08:58 AM   #8
rtg
Member
 
Registered: Aug 2005
Location: Ukraine
Distribution: Ubuntu 9.04
Posts: 99
Blog Entries: 3

Rep: Reputation: 19
If you have a lot of small files the process is not very optimized - you get more technical info transmitted than your own data. I advise you to create either tarball or zip archive prior to update. This will make only one file required to upload. This will work if you have no plans to expose your files to the users of internet, because you'll then have to unpack the archive at the server side.
 
Old 11-25-2005, 09:55 PM   #9
rblampain
Senior Member
 
Registered: Aug 2004
Location: Western Australia
Distribution: Debian 11
Posts: 1,310

Original Poster
Rep: Reputation: 53
Thanks rtg, great advice as it is a lot of small files.
 
  


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
FTP upload hinetvenkat Linux - Software 3 06-02-2005 09:34 PM
slow ftp upload haydn Linux - Newbie 4 07-24-2003 12:18 PM
Cant upload to another FTP brandog Linux - Software 1 05-03-2003 02:47 PM
Can't Upload FTP twantrd Linux - General 1 03-28-2003 09:15 PM
ftp upload hotrodowner Linux - Networking 20 10-11-2002 04:23 PM

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

All times are GMT -5. The time now is 04:03 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