Ftpmirror is an utility to copy directory hierarchy (this is called ``mirror'') with FTP. A transfer is triggered only when modified, it can be efficient transferring directory trees.
It is userful for ftp-servers maintenance, contentns sync with web server, system backupping and so on.
A similar perl script exists, whose name is `mirror', this implementation is fully comparing directory lists of sources and distination, it take a heavy memmory load. If use on a large directory trees, so eat a lot of memory(or swap) spaces. When I use ftp-server with 16MB memory, 'mirror' software is not usable :-p, so I wrote software from scratch, that is frpmirror. For example, full mirroring of FreeBSD distribution (ftp://ftp.FreeBSD.ORG/pub/FreeBSD/*) needs 8~9 MB. *(Notice by translator) Original document wrote at old(1998). May be this results has obsolete.*
You need perl-5.003 or later to use ftpmirror. Please ensure that perl-5.003 or later was installed in your environment, at first. But, perl 5.004 has a bug of memory leak. It eat a lot of memory spaces when mirroring directory tree. I test with perl5.005, it has small memory leak too, it is smaller than perl 5.004, it is not critical for real usage. I suggest you using Perl 5.005.
Please use these URLs.
Since ftpmirror is a archive of instal files, you must only extract the archive. Do one of following:
% cd /usr/local/src % gzip -cd < /tmp/ftpmirror-x.y.tar.gz | tar xf -So create a directory named ftpmirror-x.y. Change directory and execute configure:
% cd ftpmirror-x.y % ./configureOr, when you need specific perl version:
% cd ftpmirror-x.y % env PERL=/usr/local/bin/perl5.005 ./configureExecute make:
% makeWhen finished make with no errors. So install:
% su # make installIn finished this procedure, so installed files are below paths:
/usr/local/bin/ftpmirror /usr/local/bin/rotate /usr/local/etc/ftpmirror.cf-sample /usr/local/lib/perl5/site_perl/Fan.pm /usr/local/lib/perl5/site_perl/Fan/... (and some dirs) /usr/local/lib/perl5/site_perl/auto/Fan/... (and some dirs) * Notice: libraries install directory can changes with perl's installed settings.And copying and editing a configuration files, please add difinition what you needs.
# cd /usr/local/etc # cp ftpmirror.cf-sample ftpmirror.cf # vi ftpmirror.cf
Configuration parameters have follwoing types.
Default parametes: Configuration files settings. They are written before Serverss and Packages parameters. Server parameters: Difinition of server specific(timeouts, gateways and so on..). They are provided at configuration files, with 'server' parameters. Package parameters: Difinition of packages specific(direcotry, transfer modes and so on). They are provided at configuration files, with 'package' parameters. Option parameters: It provide by command args.Their parameters are settings by adove order(when exists). Option parameters are most prefferd.
How to settings parameters at configuration files:
That has two syntaxr,
param-name = value or param-name += value = is set param-name by value. += is adding value(strings) for param-name.
How to settings parameters at commands args:
When using by commands args,any parameters must be
prepended by "--" in command line options.
That use --(two minus) before options.
For example, following syntax is same as adove
configuration settings.
% ftpmirror --param-name=value ... % ftpmirror --param-name+=value ...
There are many acceptable parameters as follows:
remote-directory = /pub/FreeBSD local-directory = /ftp/pub/FreeBSDIf home-directory is defined (or ftp user's home directory exists), you can specify as follows:
remote-directory = /pub/FreeBSD local-directory = ~/pub/FreeBSD
package = FreeBSD ftp-server = ftp.FreeBSD.ORG remote-directory = /pub/%s local-directory = ~ftp/pub/%s master-db-directory = ~ftp/db/%sAddition, when dont use mirroring, master-db-direcoty can manage directory tree. Example is below.
package = original-tools local-directory = ~ftp/pub/%s master-db-directory = ~ftp/db/%sFor update database only please execute:
% ftpmirror --todo=update-master original-toolsIf remote server has a master-db-directory, it can use "slave mode" mirroring. Please set remote-db-directory and local-db-cirectory parameters.
package = FreeBSD ftp-server = ftp.master.server.host remote-directory = /pub/%s local-directory = ~ftp/pub/%s remote-db-directory = /db/%s local-db-directory = ~ftp/db/%sFor advence, you can cumulative mirroring with step files. Configuration is same adove, use:
% ftpmirror --todo=step-mirror FreeBSD
ftp-server = ftp.freebsd.org remote-directory = /pub/FreeBSD local-directory = ~/pub/FreeBSD lslR-file = /pub/FreeBSD/ls-lR.gz
Some examples follow:
transfer-file-regexp += !/~$/ transfer-file-regexp += !/\/\.in/ transfer-file-regexp += !/\/\.nfs/With this configuration, ftpmirror does NOT transfer files end with "~" and begin with ".in" or ".nfs".
(Notes: "=" means replacing a parameter value, and "+=" means appending a parameter string)
transfer-file-regexp += /\/bash-/ transfer-file-regexp += /\/gcc-/ transfer-file-regexp += !With adobe configuration, ftpmirror tries to transfer bash-* and gcc-* files, but not others. The last line in this example means ftpmirror does NOT transfer by default.
transfer-directory-regexp += !/\/lost+found\/$/ transfer-directory-regexp += !/~\/$/
transfer-file-regexp += /\/bash-/ transfer-file-regexp += ! override-file-regexp += /\/bash-/ override-file-regexp += !
package = FreeBSD ftp-server = ftp.tokyonet.ad.jp remote-directory = /pub/FreeBSD local-directory = ~/pub/FreeBSD override-directory-regexp += !/\.\/FreeBSD-nonUS\// package = FreeBSD-nonUS ftp-server = ftp.waseda.ac.jp remote-directory = /pub/FreeBSD-nonUS local-directory = ~/pub/FreeBSD/FreeBSD-nonUS
Ftpmirror generate ".dirinfo" file if store-local-dirinfo parameter is 1. You can also generate this file with mkdirinfo:
# mkdirinfo /ftp/pub/utils
subscribe ftpmirrorto majordomo@ftp.intec.co.jp.