[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: rsync ler de arquivo



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 03/06/2006 09:38 PM, Fabio Guerrazzi wrote:
> Desculpe-me, esqueci de colocar a mensagem de erro.
> Veja:
> 
> # cat lista
> /etc/fstab
> /etc/passwd
> 
> # rsync -a --files-from=lista /media/backup/tmp2/
> rsync error: syntax or usage error (code 1) at options.c(1192)
> 
> sendo que /media/backup/tmp2/ é um diretório da máquina de backup montado
> por nfs.
> 
> 
> Agradeço a ajuda (não retornei o mail antes pois passei o dia longe daqui),
> Fabio.

	Do maravilhoso e mundialmente conhecido "man rsync":


   --files-from=FILE
              Using this option allows you to specify the exact list of  files
              to transfer (as read from the specified FILE or "-" for standard
              input).  It also tweaks the default behavior of  rsync  to  make
              transferring just the specified files and directories easier:

              o      The  --relative  (-R)  option is implied, which preserves
                     the path information that is specified for each  item  in
                     the  file  (use  --no-relative  if  you want to turn that
                     off).

              o      The --dirs (-d) option  is  implied,  which  will  create
                     directories  specified  in  the  list  on the destination
                     rather than noisily skipping them.

              o      The --archive  (-a)  option's  behavior  does  not  imply
                     --recursive  (-r),  so specify it explicitly, if you want
                     it.

              The file names that are read from the FILE are all  relative  to
              the  source  dir  -- any leading slashes are removed and no ".."
              references are allowed to go higher than the  source  dir.   For
	      example, take this command:

                 rsync -a --files-from=/tmp/foo /usr remote:/backup

              If  /tmp/foo  contains  the  string  "bin" (or even "/bin"), the
              /usr/bin directory will be created as /backup/bin on the  remote
              host  (but  the  contents  of the /usr/bin dir would not be sent
              unless you specified -r or the names were explicitly  listed  in
              /tmp/foo).  Also keep in mind that the effect of the (enabled by
              default) --relative option is to duplicate only  the  path  info
              that  is read from the file -- it does not force the duplication
              of the source-spec path (/usr in this case).

              In addition, the --files-from file can be read from  the  remote
              host instead of the local host if you specify a "host:" in front
              of the file (the host must match one end of the transfer).  As a
              short-cut, you can specify just a prefix of ":" to mean "use the
              remote end of the transfer".  For example:

                 rsync -a --files-from=:/path/file-list src:/ /tmp/copy

              This would copy all the files specified in  the  /path/file-list
              file that was located on the remote "src" host.



	Ou seja, ainda que você especifique --files-from=LISTA você ainda
precisa dizer qual o diretório de origem e a lista será relativa a ele.
Portanto seu comando teria que ser algo como:

	rsync -a --files-from=lista / /media/backup/temp2


	Isso deve funcionar, mas cuidado, teste antes e veja os exemplos,
o rsync é uma ferramenta poderosa, usá-lo da maneira errada como root
pode trazer conseqüências indesejadas.


	Abraço,

- --
Felipe Augusto van de Wiel (faw)
"Debian. Freedom to code. Code to freedom!"
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Debian - http://enigmail.mozdev.org

iD8DBQFEDPb0CjAO0JDlykYRAvQZAKCzdaTJAq8Oeclg2FyEJunwiw48rQCg0wwK
8M9OGXYgsA2tn+TV1WHqpZU=
=6acd
-----END PGP SIGNATURE-----



Reply to: