[CentOS] CentOS] Remote archiving with tar over ssh

Donald Murray, P.Eng. donaldm314 at gmail.com
Fri Aug 12 21:10:45 UTC 2005


Hi James,

On 8/12/05, James B. Byrne <ByrneJB at harte-lyne.ca> wrote:
> 
> >
> On Fri Aug 12 17:14:00 UTC 2005 Paul Heinlein heinlein at madboa.com
> wrote:
> 
> >
> > How about
> >
> > tar c $(find / -name \*.conf) | ssh host.com "gzip -c > file.tar.gz"
> 
> Thank you very much, this worked.  I have two supplementary
> questions.  First, what is the significance of the $() construct in
> bash and how does it interact with tar? Does it take the place of
> standard input based on its position in the utility call?

The $() construct is command substitution. You often see it as
a pair of backticks ``.

In your case, the "tar c" command is followed by the output from the find
command.

See the following for more info:
http://www.tldp.org/LDP/abs/html/commandsub.html

> 
> Second, is there a way to exclude certain file names from matching
> that otherwise do?  I have tried:
> 
>  $(find / -name /*.conf && !*.so.conf)
> 
> and several variants without any success.
> 

You could do this in at least two ways:
$( find / -name /*.conf | grep -v "*.so.conf" )
$( find / -name /*.conf -not -name *.so.conf)

The former ignores any line endingin in .so.conf; the latter uses native 
find functionality.



> I am not using rsync, yet, due to lack of familiarity with it and a
> pressing need to get something working now.  Once the essentials are
> in place then I will look at alternatives.
> 
> Regards,
> Jim
> 
> --
> 
> ***     e-mail is NOT a secure channel     ***
> James B. Byrne                mailto:ByrneJB.<token>@Harte-Lyne.ca
> Harte & Lyne Limited          http://www.harte-lyne.ca
> 9 Brockley Drive              vox: +1 905 561 1241
> Hamilton, Ontario             fax: +1 905 561 0757
> Canada  L8E 3CE               delivery <token> = hal
> _______________________________________________
> CentOS mailing list
> CentOS at centos.org
> http://lists.centos.org/mailman/listinfo/centos
>



More information about the CentOS mailing list