Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
11-21-2005, 01:19 AM
|
#1
|
Senior Member
Registered: Aug 2004
Location: Western Australia
Distribution: Debian 11
Posts: 1,310
Rep:
|
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.
|
|
|
11-21-2005, 02:48 AM
|
#2
|
Member
Registered: Aug 2005
Location: Ukraine
Distribution: Ubuntu 9.04
Posts: 99
Rep:
|
Use lftp ( http://lftp.yar.ru/) - it has a nice command line interface and built-in functionality for mirroring of site.
|
|
|
11-22-2005, 04:28 AM
|
#3
|
Senior Member
Registered: Aug 2004
Location: Western Australia
Distribution: Debian 11
Posts: 1,310
Original Poster
Rep:
|
Thank you rtg, I'll try that.
|
|
|
11-23-2005, 03:18 AM
|
#4
|
Senior Member
Registered: Aug 2004
Location: Western Australia
Distribution: Debian 11
Posts: 1,310
Original Poster
Rep:
|
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.
|
|
|
11-23-2005, 01:43 PM
|
#5
|
Member
Registered: Aug 2005
Location: Ukraine
Distribution: Ubuntu 9.04
Posts: 99
Rep:
|
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.
|
|
|
11-23-2005, 05:35 PM
|
#6
|
Member
Registered: Dec 2003
Location: Fresno
Distribution: Gentoo Ricer
Posts: 85
Rep:
|
[plug]
ncftp
[plug /]
|
|
|
11-24-2005, 09:56 PM
|
#7
|
Senior Member
Registered: Aug 2004
Location: Western Australia
Distribution: Debian 11
Posts: 1,310
Original Poster
Rep:
|
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.
|
|
|
11-25-2005, 08:58 AM
|
#8
|
Member
Registered: Aug 2005
Location: Ukraine
Distribution: Ubuntu 9.04
Posts: 99
Rep:
|
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.
|
|
|
11-25-2005, 09:55 PM
|
#9
|
Senior Member
Registered: Aug 2004
Location: Western Australia
Distribution: Debian 11
Posts: 1,310
Original Poster
Rep:
|
Thanks rtg, great advice as it is a lot of small files.
|
|
|
All times are GMT -5. The time now is 04:03 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|