Solved

fileserver

Posted on 2004-04-13
9
252 Views
Last Modified: 2010-04-20
  My office have ftp sever how can i set ftp client to back up some folder automatic every day
Thank
0
Comment
Question by:teera
  • 4
  • 3
  • 2
9 Comments
 
LVL 12

Accepted Solution

by:
stefan73 earned 250 total points
ID: 10813580
Hi teera,
Check "man .netrc" how to install some automatic FTP script.

You probably should use a two-stage cron script:

1. A script which creates the backup file

(like with:
find $HOME -type f -mtime -1 > ~/newfiles
tar -cf - --files-from ~/newfiles | bzip2 -9 > newfiles.tar.bz2
mv newfiles.tar.bz2 newfiles_ready.tar.bz2

Instead of $HOME you can use any other folder. bzip2 is very efficient, but also a bit slow. If speed is an issue, use gzip -1 instead.
)

2. An FTP script which simply uses "ftp backup", which will then use all the settings you defined in .netrc

-> This is still quite crude. There are better ways, such as using rsync via ssh. But you'll probably want a working solution first before refining it.


Cheers,
Stefan
0
 
LVL 44

Expert Comment

by:Karl Heinz Kremer
ID: 10817564
You can also use wget to retrieve the files from the ftp server. wget should be part of any major Linux distributions.
0
 
LVL 8

Assisted Solution

by:da99rmd
da99rmd earned 100 total points
ID: 10832717
Here is a easy sript based on  stefans code:

#!/bin/bash
tar -cf - (the name of the dir to backup) | bzip2 -9 > newfiles.tar.bz2 && mv newfiles.tar.bz2 newfiles_ready.tar.bz2 && ncftpput -u (username) -p (password) (remote-host) (remote-directory) newfiles_ready.tar.bz2
# End script

/Rob
0
 
LVL 44

Expert Comment

by:Karl Heinz Kremer
ID: 10832779
ncftpput is part of ncftp, which may not be installed automatically (or may not be part of your distribution at all).
0
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
LVL 8

Expert Comment

by:da99rmd
ID: 10832802
ncftp but its part of most distributions, and then how do you use wget to put files ?

/Rob
0
 
LVL 44

Expert Comment

by:Karl Heinz Kremer
ID: 10833099
You run wget from the machine that receives the files. If you need to put something on a ftp server, you need wput (which is a seperate project, and not part of most distributions).
0
 
LVL 12

Expert Comment

by:stefan73
ID: 10833108
>how do you use wget to put files ?

You could have the server "pull" them instead of the client "pushing" them. But you're right, this is probably less efficient.

The only reason to use this is security considerations. If the client is considered "unsafe", it's better to have the server get the file.
0
 
LVL 44

Expert Comment

by:Karl Heinz Kremer
ID: 10833114
The question did not say which directions the files need to be moved. I just assumed that something on the server needs to be backed up. But you are right, it could be the other way as well.
0
 
LVL 8

Expert Comment

by:da99rmd
ID: 10833401
teera, plz give some more detailed information about what you mean.

/Rob
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

If you have a server on collocation with the super-fast CPU, that doesn't mean that you get it running at full power. Here is a preamble. When doing inventory of Linux servers, that I'm administering, I've found that some of them are running on l…
You ever wonder how to backup Linux system files just like Windows System Restore?  Well you can use Timeshift in Linux to perform those similar action.  This tutorial will show you how to backup your system files and keep regular intervals. Note…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now