File: fmirror.1

package info (click to toggle)
fmirror 2%3A0.8.4-12
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 336 kB
  • ctags: 230
  • sloc: ansic: 2,954; sh: 126; makefile: 74
file content (620 lines) | stat: -rw-r--r-- 18,191 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
.TH FMIRROR 1 "09 Mar 2000" 
.SH NAME
fmirror \- Mirror directories from ftp servers
.SH SYNOPSIS
.B fmirror
[\-a\ account]
[\-A\ and\-mask]
[\-O\ or\-mask]
[\-C\ config\-line]
[\-N]
[\-c\ dircommand]
[\-D\ timezone\-dircmd]
[\-d\ log\-level]
[\-e\ exclude\-entry]
[\-i\ include\-entry]
[\-f\ config\-file]
[\-F\ pidfile]
[-h]
[\-k]
[\-l\ local\ dir]
[\-M\ use\-MDTM]
[\-m\ dirmode]
[\-P\ port]
[\-p\ password]
[\-r\ remote\ dir]
[\-R]
[\-s\ hostname]
[\-S]
[\-T\ remote\-timezone]
[\-t\ timefuzz]
[\-u\ username]
[\-v]
[\-V verbosity]
[\-X maxdel]
[\-x\ decompressor]
[\-o\ option]
[\-z]
.SH DESCRIPTION
.B fmirror
is a program for mirroring a directory from a remote ftp server. It
allows regex-matching for files that are to be included and
excluded. It uses a combination of timestamp, file size and file
permissions to decide what files to transfer from the ftp server.

The primary goal of
.B fmirror
is to use as little memory as possible, but still be able to do its
job efficiently.
.B fmirror
can delete any files not found on the remote server.

.SH OPTIONS

.TP
.BI "\-a" " account"
Account (not login) id and password separated by forward slash - id/pass.
This informations is provided according RFC959.

The argument field is a Telnet string identifying the user's account.  The
command is not necessarily related to the USER command, as some sites may
require an account for login and others only for specific access, such as
storing files.  In the latter case the command may arrive at any time.
                                                                                           
There are reply codes to differentiate these cases for the automation: when
account information is required for login, the response to a successful
PASSword command is reply code 332.  On the other hand, if account information
is NOT required for login, the reply to a successful PASSword command is 230;
and if the account information is needed for a command issued later in the
dialogue, the server should return a 332 or 532 reply depending on whether it
stores (pending receipt of the ACCounT command) or discards the command,
respectively.

.TP
.BI "\-A" " mask"
Remote file permissions will be binary anded by
.I mask
before being
compared.  The same mask is also used when creating files. Default
value is 0111, which results in only executable bits being mirrored.
The or mask will be ored in after the and mask is anded in.

.TP
.BI "\-O" " mask"
Remote file permissions will be binary ored by
.I mask
before being
compared. The same mask is also used when creating files. Default
value is 0444, which results in all files being readable for everyone.
This mask will be ored in after the and mask has been anded in.

.TP
.BI "\-C" " line"
Parses
.I line
as if it was a line in a config-file.

.TP
.B "\-N"
Don't delete files that are missing from the ftp server. Files that
are replaced by files of other types will still be deleted and updated.

.TP
.BI "\-c" " command"
Use
.I command
as a dir-command. To read a ls-lR file instead of performing a heavy
ls-operation on the ftp-server, use "RETR ls-lR". The default value is
"LIST -lRa".

.TP
.BI "\-D" " command"
Use
.I command
as a dir-command for finding the remote timezone.  See also the
equivalent dircmd_tz: configuration file keyword.

.TP
.BI "\-d" " debug-level"
The level of debugging (spam) output that is wanted. The default debug-level
is 3.

.TP
.BI "\-e" " exclude\-opt exclude\-pattern"
Add an exclude-entry. See discussion for exclude: in the configuration
files section. The option and pattern must be one word to the shell,
so enclose both in a single "-pair, ie <fmirror -e "p old/">.
\#"

.TP
.BI "\-i" " include\-opt include\-pattern"
Add an include-entry. See discussion for include: in the configuration
files section.

.TP
.BI "\-f" " config\-file"
Reads options from
.I config-file.
See the section
.B CONFIGURATION FILES
for more information about the contents of a config-file.

.TP
.BI "\-F" " pid\-file"
Write the pid (process id) of the fmirror process to
.I pid\-file.
This is useful when you want to avoid running more than one copy of
fmirror from cron or similar.

.TP
.B "\-h"
Display brief option-summary.

.TP
.B "\-k"
Only download files that are newer than the local copy.

.TP
.BI "\-l" " local-dir"
Change directory to
.I "local-dir"
(locally) before mirroring.

.TP
.BI "\-M" " use-MDTM"
set the flag for using MDTM exension.  Equivalent to the use_mdtm:
keyword, which is described in detail in the configuration file section.

.I mode.
Default value is 0755 (octal).


.TP
.BI "\-m" " mode"
All local directories will be made with mode
.I mode.
Default value is 0755 (octal).

.TP
.BI "\-P" " port"
Connect to port
.I port
on the remote ftp server.

.TP
.BI "\-p" " password"
The password you want to use on the ftp server. When doing anonymous
ftp, this should be your email address. If password is not specified,
it be set to 'username@', where
.I username
is the username corresponding
to the real UID of fmirror.

.TP
.BI "\-r" " remote-dir"
Change directory to
.I "remote-dir"
(on the ftp server) before mirroring.

.TP
.B "\-R"
Set timestamp of local files to the same as remote files (for
resyncing the timestamps if you are sure the files are correct). Only
sets the timestamps if file lengths and modes match according to the
normal rules.

.TP
.BI "\-s" " hostname"
Use
.I hostname
as the ftp server to connect to.

.TP
.B "\-S"
Use passive mode for the ftp transfers. This is often necessary to get
through some firewalls.

.TP
.BI "\-T" " remote-timezone"
The remote-timezone value (in minutes) overrides the guess fmirror will
do on the timezone the remote FTP server operates in.  Equivalent to
the remotetz: keyword, which is described in detail in the configuration
file section.

.TP
.BI "\-t" " timefuzz"
Allow timestamps to differ by up to
.I timefuzz
seconds. The default value is 59. No matter what this value is set to,
files that differ by exactly 3600 seconds will always considered equal
to compensate for buggy timezone-handling. Also, files older than 60
days can differ by up to a day to compensate for lack of precision
in ls listings for previous years.

.TP
.BI "\-u" " username"
Sets your username on the ftp server to
.I username.
For anonymous ftp, this should be
.B ftp
or
.B anonymous.
The default value is anonymous.

.TP
.B "\-v"
Show version.

.TP
.BI "\-V" " verbosity"
Verbosity level, 1 is suitable for cron jobs and 3 is suitable for
interactive use. Default is 3.

.TP
.BI "\-X" " maxdel"
Maxdel specifies the maximum number of files to delete during fmirror
invocation. If the number of deleted files exceeds maxdel the
program stops immediately with an error code.

.TP
.BI "\-x" " program"
Run
.I program
as a decompressor for the ls listing. This will only be used if
compressed dirlisting is on. This should ONLY be the name of the
executable, it must not contain any options. The default value is "gzip".

.TP
.BI "\-o" " option"
Give
.I option
as option to the decompressor. The default value is "-dc".

.TP
.B "-z"
Enable decompression of dir-listing.

.SH CONFIGURATION FILES

Unless you are just using this program to mirror a directory once,
you'll probably want to make a configuration file to make the job
easier.

The syntax of the configuration file is very simple. Any line not
starting with an alphabetical letter is considered a comment line
(blank lines are also considered comments).

The first option of a particular kind has the highest priority,
and configuration file and command line options have the same
priority. You can have any number of include and exclude options, the
first one that matches a particular file will be used.

You can also include multiple configuration files, the first
configuration file has precedence over later ones. The debug-level can
be changed between every single option on the command-line to debug
specific configuration files.

.I NOTE:
All numerical values can be written in octal (leading 0),
decimal (default) or hexadecimal (leading 0x). Modes are usually
written in octal, so make sure you write 0755 and not 755 (for example).

.TP
.BI username: " username"
Sets the username (same as -u command line option). Any whitespace
before the username will be ignored. This will typically be "ftp" or
"anonymous".

.TP
.BI password: " password"
Sets the password (same as -p command line option). Any whitespace
before the password will be ignored. This will typically be
"user@some.domain", ie "finnag@fast.no"

.TP
.BI host: " remote hostname"
Specifies the remote hostname (same as -s command line option). Any
whitespace before the hostname will be ignored.

.TP
.BI remotedir: " remote directory"
Specifies the remote directory that is to be mirrored. (same as -r
command line option). Any whitespace before the name will be ignored.

.TP
.BI localdir: " local directory"
Specifies the local directory that you are mirroring to (same as -l
command line option). Any whitespace before the name will be ignored.

.TP
.BI dircmd: " directory list command"
Specifies what command should be sent to the ftp-server to get a
directory listing. Normally this is "LIST -lRa". If you want to get a
ls-lR file instead, you can put "RETR ls-lR" here. This option is
equivalent to the -c command line option.

.TP
.BI dircmd_tz: " directory list command"
Specifies what command should be sent to the ftp-server to get a
directory listing when trying to find the remote timezone.
The default value is "LIST -ltra".
Should not be set to any recursive command.
Equivalent to the -D command line option.

.TP
.B decompressor:
If you are getting a compressed file-listing, this should be the name
of the decompressor program without any options. This is set to "gzip"
if you only enable compressed dir-listings without specifying a
decompressor. Equivalent to -x command line option.

.TP
.B decompressor_opt:
The option string that is to be sent to the decompressor. This defaults to
"-dc". Equivalent to -o command line option.

.TP
.BI port: " port"
Connect to port
.I port
on the remote ftp server. Equivalent to -P command line option.

.TP
.BI pidfile: " pid\-file"
Store the PID (process id) of the process to the file
.I pid\-file.
Equivalent to -F command line option.


.TP
.BI dirmode: " mode"
All local directories will be created with mode
.B mode.
Equivalent to -m command line option.

.TP
.BI loglevel: " level"
Specifies the logging level (debug level). Equivalent to -d command line
option.

.TP
.BI compressed: " val"
Takes an integer argument, will enable decompressing of the file listing
if
.I val
is non-zero. With a non-zero value this is equivalent to the
-z command line option.

.TP
.BI timefuzz: " fuzz"
The maximum number of seconds files can differ by and still be
considered equal. Equivalent to -t command line option.

.TP
.BI file_and_mask: " mask"
File permissions will be anded by
.I mask
before being compared and created. Equivalent to -A command line option.

.TP
.BI file_or_mask: " mask"
File permissions will be ored by
.I file_or_mask
before being created. Equivalent to -O command line option.

.TP
.BI passive: " val"
Use passive mode if
.I val
is non-zero, or normal mode if it is zero.

.TP
.BI nodel: " val"
Don't delete local files if
.I val
is non-zero (equivalent to -N command line option). Normal operation
if
.I val
is zero.

.TP
.BI log_timestamp: " val"
Only prepend timestamp on each line output if
.I val
is non-zero. Default value is 1.

.TP
.BI verbosity: " verbosity"
Chose verbosity value. The only supported values are 1, which is
suitable for non-interactive operation, and 3, which is suitable for
interactive operation.

.TP
.BI keep_newer: " val"
Takes an integer argument, will keep newer file if
.I val
is non-zero. This means that remote files that have older timestamps
than local files will not cause that file to be retrieved. Equivalent
to -k command line option.

.TP
.BI reset_times: " val"
Takes an integer argument, will reset times of files if
.I val
is non-zero. This means that files thay only differ in time-stamp, but
match in size and mode, will get their local timestamp adjusted to
that of the remote files instead of being retrieved again. Equivalent
to -R command line option.

.TP
.BI remotetz: " val"
Takes an integer argument.  The
.I val
is the remote timezone in minutes.  Typical values would be -60
for most of Europe, -540 for Japan, anywhere from 300 to 480
for the continental US, and 600 for Hawaii.
Normally, fmirror will only try to guess the timezone when use_mdtm is
in effect, and assume GMT in all other cases.  Overriding the time zone
guess is particularly important when you are fetching a ls-lR file with
RETR instead of actually doing a LIST, since the guess is based on doing
LIST and MDTM and comparing the results.

.TP
.BI use_mdtm: " val"
Takes an integer argument.  The
.I val
decides whether to try using the MDTM extension for getting remote
modification times.  To avoid constantly regetting files, this also
needs to figure out what timezone the remote server is running in,
by doing a remote "LIST -ltra", picking a file with time information,
sending an MDTM command for it, and comparing the results.  See
also the dircmd_tz: and remotetz: keywords.

A value of 0 turns off trying MDTM, a value of 1 means to use it if it
is available and we can determine the remote timezone, while any other
value (preferably 2) means to use it if it is available and assume that
the remote timezone is GMT if we can't determine it normally.
In the last case, using a large value for timefuzz (like 50000 for a
bit more than 12 hours) may also be useful.  The default value is 1.

.TP
.BI input_timeout: " num"
Will wait
.I num
seconds before forcing a read of a file to time out. No equivalent
command line option, default value is 240 seconds.

.TP
.BI connect_timeout: " num"
The timeout before retrying a connect operation (not the initial connect,
but the connects that are required to transfer files after the control
connection is up). Will wait
.I num
seconds before timing out on connects (or accepts for non-passive ftp
transfers). No equivalent command line option, default value is 120 seconds.

.TP
.BI connect_retries: " num"
The number of times to retry a connect operation (not the initial
connect, but the connects that are required to transfer files after
the control connection is up). Will try to connect up to
.I num
times before giving up. No equivalent command line option, default value
is 3.

.TP
.BI reconnect_timeout: " num"
Will wait
.I num
seconds before retrying a connect operation to a ftp server, either if
there was no reply from the ftp server at all at the initial connect,
or if the username/password combo was not allowed (usually happens on
full ftp servers). No equivalent command line option, default value is
120 seconds.

.TP
.BI reconnect_retries: " num"
Will try to connect up to
.I num
times before giving up if initial connection cannot be made. This
means that eitehr the ftp servre does not reply at all, or fmirror is
kicked out because the ftp server is full. No equivalent command line
option, default value is 15;

.TP
.BI maxdel: " num"
Maxdel specifies the maximum number of files to delete during
fmirror invocation. If the number of deleted files exceeds
.I num
the
program stops immediately with an error code.

.TO

.TP
.BI "exclude:	[i][x][n]{p|f}" "	pattern"
A regex pattern that, if matched in a particular file/path-name,
should not be mirrored. This will override any include-patterns
encountered after this. Equivalent to -e command line option.

.B NOTE:
An exclude-rule doesn't differ between files or directories. p or f
only decide whether the entire path-name or just the name of the
file/directory itself should be matched. Directories get "/" appended
before they are matched against the regex, so "exclude\ f\ ^old/"
will exclude a directory named "old" (but not necessarily its contents), but
not a file named "old".

Directories are created "on demand", so if you have excluded "old/"
but not "\\.gif$", a file with path "old/bill.gif" will cause the
"old"-directory to be made and the "bill.gif"-file to be retrieved. To
exclude any directory named "old" and all its contents, use "p (^|/)old/".

.B i
means case insensitive match.

.B x
means to match anything EXCEPT the following regex, effectively
inverting the rule.

.B n
means that the file/directory will not be deleted if it exists locally,
matches this rule, and would otherwise be deleted.

.B p
means match full path-name (eg "pub/foo.bar").

.B f
means match filename only (eg "foo.bar")

.I pattern
is an extended POSIX regular expression.

.TP
.BI "include:	[i][x][n]{p|f}" "	pattern"
A regex pattern that, if matched in a particular file/path-name,
should be mirrored. This will override any exclude-patterns encountered
after this. Equivalent to -i command line option.

The options are identical with the
.B exclude
options.

.SH EXAMPLE CONFIGURATION FILES
There should be several sample configuration files with your copy of
fmirror in the
.B configs
directory.

.SH
BUGS

Transient errors are not handled well. If one file cannot be
transferred for some reason, such as 'Failed to make data socket',
it doesn't try to get that file again, so you effectively lose the file.

.SH COPYING
Copyright 1995\-2000  Finn Arne Gangstad and Tor Egge.
.PP
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
are preserved on all copies.
.PP
Permission is granted to copy and distribute modified versions of this
manual under the conditions for verbatim copying, provided that the
entire resulting derived work is distributed under the terms of a
permission notice identical to this one.
.PP
Permission is granted to copy and distribute translations of this
manual into another language, under the above conditions for modified
versions, except that this permission notice may be included in
translations approved by the Free Software Foundation instead of in
the original English.
.SH AUTHORS
.B fmirror
was written by
.br
Finn Arne Gangstad <finnag@fast.no>
.br