Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have a file on my server that is changing constantly, it changes hourly, sometimes it changes every minute. The file is is growing, but not so fast.

This file is generated inside a dir called /home/my_user/backup123/subnets.cfg, until here no problem.

This is my first question: Now I need to put this file on a remote server. What is the best way to do this? From my local server, that where the file is located or across the remote server?

Here is my second question: If I do across the remote server I think I need to use the wget command right? I have tried to use this command:

 wget --user=my-user --password=password http://example.com/dir/subnets.cfg

But it is not working, it tells me "wrong user name". Of course I had use my own user name and password, but it is not working. I have permissions to the file and dir.

I need to get the subnets.cfg file and put it on my remote server, how can I do that?

share|improve this question
    
perheps I can use the wget inside the cron jobs, something like this -> 0 0 * * 0 wget --mirror example.com/dir/subnets.cfg -o /home/my_user/my_files/ But it is only the idea, firstly I need everything above working properly.. :) –  B4NZ41 Apr 12 '11 at 15:32
    
make sure that user is the .htaccess user and password the .htaccess password. –  omnidan Apr 12 '11 at 15:36
    
I do not have a .htaccess file in my server, nor local neither remote. –  B4NZ41 Apr 12 '11 at 15:45
    
@Fernando Maybe it's hidden, if you really don't have a .htaccess file, remove the --user and --password args. –  omnidan Apr 12 '11 at 15:46
    
but it is 2 linux server, all file is being showed to me.. I had tried without user and password .. I get the nothing.. I'm trying to connect as root and nothing.. I know is not the best way try to connect as root, but I'm testing.. if works I'll create a new user only to the task. –  B4NZ41 Apr 12 '11 at 15:47

1 Answer 1

up vote 2 down vote accepted

If you want to download a file from a FTP server over wget, you have to type:

wget -t 10 -nH -P backup -r ftp://USER:PASSWORD@ftp.example.com/dir/subnets.cfg

Replace USER with your ftp username and PASSWORD with your ftp password.

I hope this helped you,

Daniel

share|improve this answer
1  
It works like a charm!! Thanks, that's it man! Your help was completly useful to me. –  B4NZ41 Apr 12 '11 at 22:37

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.