.TH AFCLIENT 8 "2001 April 1" "Debian Project"
.SH NAME
afclient \- controls the client functions of the afbackup package
.SH SYNOPSIS
.B afclient 
-cxtd [-[RraunlOUvgIiqQZwbjGK]]
[-D <destination>]
[-M <message>]
[-m <message-poll-interval>]
[-h <backup-server>]
[-z <proccmd> <unproccmd>]
[-T <to-extract-file/tmpdir-for-copytape>]
[-C <cartridge-number>]
[-F <filenumber-on-tape>]
[-f <archive-filename>]
[-e <errorlog-filename>]
[-p <server-port-number>]
[-N <newer-than-filename>]
[-o <user-ID>]
[-k <encrption-key-file>]
[-s <dont-process-filepattern> [-s ...]]
[-H <header>]
[-V <statistics-report-file>]
[-A <after-time-seconds>]
[-B <before-time-seconds>]
[-W <identity>]
.I [<files> <directories> ...]
.br
.B afclient 
-X <program>
[ -h <backup-client> ]
.br
.B afclient 
-?  
.br
.B afclient 
-usage
.PP
The first form is similar to 
.B tar
(1), except that it contacts a
backup server, if the -f option is not supplied.
.PP
The second form is used to start a program remotely on
another host. In most cases this will be one of:
.PP
.RS
.B afclient 
-X full_backup -h <some-host>
.br
.B afclient 
-X incr_backup -h <some-host>
.br
.RE
.PP
Normally this host is a backup client and a backup is started
this way. Only programs can be started, that reside in the
directory, that is configured in the backup server's
configuration file unter "Program-Directory".
.PP
The third form produces the following help text:
.SH DESCRIPTION
This program is used to maintain archives on a backup server
host or in a file. Archives can be created, extracted or their
contents be listed. One of the following flags has always to
be supplied:
.TP
.B -c 
to create an archive
.TP
.B -x 
to extract from an archive
.TP
.B -t 
to list the contents of an archive
.TP
.B -d 
to verify (compare) the contents of an archive
.TP
.B -C  
to set a certain cartridge on the backup server
(makes only sense extracting or listing with 
.B -x 
or
.B -t, 
the writing position can't be changed by clients)
.TP
.B -F  
to set a certain file on the backup server's tape
(same applies as for 
.B -C
)
.TP
.B -q  
to printout the current cartridge and tape file number
on the backup server
.TP
.B -Q  
to printout the cartridge and tape file number for the
the next write access on the backup server
.TP
.B -X  
followed by the full path name of a program to be started on
the client. This can be used to trigger a backup remotely.
If the program needs arguments, the command together with
the arguments has to be enclosed by quotes
.TP
.B -I
to printout an index of the backups written to the current
cartridge
.TP
.B -w
to check the status of the streamer on the server side, e.g.
whether it is ready and waiting for requests to service,
see below for possible states
.TP
.B -G
to request a new cartridge for the next writing operation.
If the current writing position is already at the beginning
of a new or reused tape, nothing happens
.TP
.B -D <destination>
to make an exact copy of a tape to another one
(duplicate). See below how to specify the destination tape.
Duplication can be either from one cartridge to another on
the same server, or from one server to another one. When
copying to the same server chunks of data are stored in a
temporary directory on the client, where the command is
started, what should preferably be the source server
.TP
.B -M <message>
Send a message to the server. Messages will in the
most cases contain whitespace, so they should be enclosed
in quotes. Server messages should be sent to the single
stream server (port), the multi stream server might hang
receiving a message due to systematical reasons. Several
messages can be put into the string. They must be separated
by a real newline character or the usual C-like \n .
The following messages are currently supported:
.RS
.TP
PreciousTapes: <list-of-tapes>
The list of tapes is inserted into the table
with the tapes, that are crucial for clients
to restore all files, that are listed in all
existing index files. These tapes will not be
overwritten until explicitly permitted. This
message is generated automatically and should
not be used in other user contexts
.TP
ReuseTapes: <list-of-tapes>
The opposite of PreciousTapes. Sending this
message permits the server to overwrite the
listed tapes, though they are crucial for
some client
.TP
TapesReadOnly: <list-of-tapes>
The list of tapes is inserted into the file
listing the files, that should not be written
any more for whatever reason
.TP
TapesReadWrite: <list-of-tapes>
This reverts the status of tapes set read-only
to read-write, the opposite of TapesReadOnly
.TP
CartridgeReady
When an operator is requested to do something
the server is waiting for, this message can be
sent to trigger the server to proceed. This
message has the same effect as the cartready
command
.TP
DeleteClient: <client-identifier>
The tapes, that are marked as reserved for a
client to recover all the data in his indexes,
are freed. That is, the appropriate line is
removed from the server's precious_tapes file
.RE
.PP  
.B -c, -x, -t, -d, -X, -d
and
.B -I
are mutual exclusive. The other options can
be supplied as needed. To set the cartridge and/or the tape file
on the backup server is only making sense when not creating
an archive. The serial order of writing to tape is handled by
the server machine independently of the client.
.PP  
More options in alphabetical order:
.TP
.B -
in combination with -c: read standard input and
write it to tape, in combination with -x: read
tape and write it to standard output
.TP
.B -A <time>
process files (save or extract) modified after
the given time in seconds since 1.1.1970 00:00
.TP  
.B -a
in combination with 
.B -x
: extract all files and directories in the archive
.TP  
.B -b
don't enter buffering mode
.TP
.B -B <time>
process files (save or extract) modified before
the given time in seconds since 1.1.1970 00:00
.TP
.B -e <errlog>  
Use the file <errlog> to write error messages to
instead of the standard error output
.TP  
.B -f <file>    
write to or read from a file instead of querying
the backup server
.TP  
.B -g           
while extracting/reading: ignore leading garbage,
suppress error messages at the beginning. This
is useful when extracting from tape files, that
are not the first ones of a whole archive.
.TP
.B -H <header>
put the supplied informational header to the begin
of the backup. If a - is supplied (no space may
follow -H i.e. -H-) the information is read from
the first line of stdin. Backslash sequences of
C-like style are replaced
.TP
.B -h <host>    
use the backup server with the name <host>
default host is the machine with the name
backuphost
.TP  
.B -i           
while extracting: ignore the stored ownership and
do not restore it
.TP
.B -j
when starting to write: request starting a new
tape file
.TP
.B -K
when packing, do not keep the access time of the
file. By default after packing a filesystem entry
it's previous atime is restored
.TP  
.B -k <file>    
use the contents of the given file as encryption
key for authenticating to the server
.TP  
.B -l
for each packed or unpacked filename, if sending
to or receiving from a backup server in verbose
mode in combination with -n:
printout server name and port number at the
beginning of the line, e. g.: orion%2988!
.TP
.B -N <file>    
while archiving: ignore files with a modification
time before the one of the given file, only save
newer files or such with the same age in seconds
.TP
.B -n           
for each packed or unpacked filename, if sending
to or receiving from a backup server in verbose
mode:
printout cartridge and tape file number at the
beginning of the line, e. g.: 7.15: <filename>
.br
In combination with -X: precede each line of
output received from the remotely started program
with the identifier of the remote host and a
colon, e. g.:  darkstar: Full backup finished.
.TP
.B -O           
for each packed file creating a backup in verbose
mode: printout the user-ID of the file owner at
the beginning of the line prefixed with a bar |
eventually behind cartridge and file number
.TP
.B -o <uid>     
archive or extract only files owned by the user
with the given user-ID (an integer)
.TP  
.B -p <portno>  
use a different port number for communicating with
the backup server. Default is TCP-Port 2988
.TP  
.B -R           
pack or extract directories recursively with all
of their contents
.TP  
.B -r           
use filenames relative to the current directory,
whether they start with a slash or not. If -r
is given more then 1 time, also let symlinks
originally pointing to absolute paths now point
to paths relative to the directory, where the
symlink will be created
.TP
.B -S <cartset> 
The cartridge set to use, where <cartset> is the
number of a valid cartridge set on the server
side. Default is 1. This option makes sense only
when creating backups with 
.B -c
.TP
.B -s <filepat> 
do not attempt processing on files matching the
given filename pattern. This parameter may
appear several times
.TP
.B -T <file>    
read the filenames to process from the <file>.
The filenames must be separated by whitespace.
If whitespace is part of a filename, it has to
be enclosed by double quotes. Double quotes or
backslashes within the filename have to be
preceded by a backslash. In combination with
-D: the tape files to be copied are temporarily
stored in the given directory instead of the
default directory /tmp
.TP
.B -U          
for each packed file creating a backup in verbose
mode: printout the modification time of the file
in seconds since 1970/1/1 0:00 at the beginning
of the line prefixed with a tilde ~ eventually
behind cartridge number, file number and owner
.TP  
.B -u           
while extracting: remove existing files with the
same name as found in the archive. Otherwise
no existing files are overwritten
.TP  
.B -V <file>    
write a report containing statistics at the end of
a backup to the <file>
.TP
.B -v           
verbose mode: print the filenames while creating
or extracting, be a little more verbose while
listing contents. If -v is the only given flag:
print out software name and version
.TP  
.B -z <z> <uz>  
use <z> as the command, that is used to process
files, <uz> for the corresponding unprocess.
The command has to read from stdin and to write
to stdout. If arguments have to be supplied to
<z> and/or <uz>, don't forget to use quotes. If
built-in compression is desired, the command for
processing has to start with a dot (.), followed
by a space and a number ranging from 1 to 9, that
specifies the compression level. If an additional
external command should process the data, it may
follow, separated from the compression level by
whitespace. The order of processing is: First the
external program processes the data, then built-in
compression is applied. An empty string has to be
supplied for <uz> (or any other dummy is ok), if
only built-in compression is desired.
Examples for <z>:
.IP
.br
 gzip       (run external command gzip),
 "gzip -2"  (the same with an argument),
 ". 8"      (only built-in compression level 8),
 ". 3 __descrpt -k /my/key" (run command __descrpt
            and apply built-in compression level 3)
.fi
.TP  
.B -Z           
while printing out the contents: check those files
in the archive that are processed for integrity.
While creating an archive: write a CRC32 checksum
for each file, file contents or command output to
the backup stream
.TP  
.B -?           
to printout this text
.SH FILENAMES
The names of the files and directories, that have to be put
into or extracted from an archive are by default read from the
standard input. If you supply filenames in the command line or
enter the 
.B -a 
flag when extracting, standard input is not read.
The same applies, when filenames are read from a file with the
.B -T 
option. When reading the names from a file or from standard
input, they must be given one per line. If a name contains
special characters (like newline or nonprintable ones), they
have to be specified using backslash-sequences like in C-code,
e.g. \\n for newline.
In save mode (
.B -c
) filenames can be prefixed with character
sequences, that have special meanings (no space between prefix
and filename):
.TP
/../
The file is not saved with all attributes present
in the inode, but only the contents are saved.
This might be useful for saving raw-devices
.TP
//../
With /../ the configured processing is not
applied to the file contents for safety reasons.
With this prefix processing can be forced
nonetheless
.TP
|||
and a mandatory space character indicates, that
the following characters up to (but not including)
another triple bar ||| should be interpreted as a
shell command, that is started and whose standard
output is written to the backup. At restore time
the command following the second triple bar is
started and the data stream read at backup time is
written to it's standard input. This might be
useful for saving e.g. databases. The second
command may be terminated by a triple sharp ###,
that starts an optional comment.
Example:
.IP
.nf
||| pg_dumpall ||| psql db_tmpl ### Store Postgres DBs
.fi
.SH STATUS REPORTS
The -w option reports one of the following states,
separated by the plus character + :
.TP
.B READY
the device is not in use by any program and the
server side is ready to service requests
.TP
.B BUSY
the device is in use and currently operated by the
afbackup service
.TP
.B DEVINUSE
the streamer device is in use by some program, that
is not part of the afbackup service
.TP
.B UNAVAIL
the streamer device is not accessible or in some
other way occupied
.TP
.B UNLOADED
the device is not busy, but there is no tape loaded
.TP
.B CHANGEABLE
when reported together with UNLOADED, a tape can be
loaded quickly e.g. using the afclient command with
option -C <cartno>. It is not considered quickly,
if a human operator must put the cartridge into the
drive, so in this case only UNLOADED is reported.
When reported with READY, the tape can be changed
quickly (same understanding as before).
.SH DESTINATION
The destination tape for the duplicate operation can be given
in two ways: either with the options -h, -p, -C and -k following
the -D immediately without space and enclosed in quotes, so that
they appear as an own argument list in one real argument, e.g.:
.LP
.nf
 -D' -C 5 -h targethost -p targetport'
(double quotes are of course also possible ...).
.fi
.PP
The second format is as follows:
.LP
.nf
 [<targetcart>][@<targethost>][%targetport>][:<targetcryptkeyfile>]
.fi
.LP
At least one of the specifiers must be present. Examples:
.LP
.nf
 5@otherhost
 5%2990:/keyfile/for/target/server
 @otherhost%2970
.fi
.LP
If one of the specifiers is omitted, it is assumed identical with
the copy source specified in the normal options -h, -p, -C and -k.
Copying a tape to itself is prevented.
.SH FILES
.IP @clientconfdir@/@clientconf@
Client configuration file
.IP @clientlogdir@
The directory for logging the client backups
.IP @clientvardir@
Some internal state information of the client backups.
.SH SEE ALSO
afclientconfig(8), xafclientconfig(8), full_backup(8),
incr_backup(8), afverify(8), afrestore(8), xafrestore(8),
afserver(8), afmserver(8),
copy_tape(8), afclient.conf(8), afserver.conf(8),
update_indexes(8), tar(1) 
.SH AUTHOR
.B afbackup 
was written by Albert Fluegel (af@muc.de). This manpage was
extracted from the text docs by Christian Meder 
(meder@isr.uni-stuttgart.de).
