How to discern when like dir names exist in 2 places

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

How to discern when like dir names exist in 2 places

Harry Putnam

with these rsync  rsync [...] /var/ /dir/
                  rsync [...] /etc/ /dir2/
                 
And exclude file: excl

  /apache2/*

That will exclude both /var/apache2/*
and                    /etc/apache2/*

How can I tell rsync I want /var/apache2 excluded, but not /etc/apache2?
I mean short of using separate excl files for each run
Using something like the start of an absolute name:
  `/etc/apache2/*'

Allows both /etc/apache2
and         /var/apache2  to be collected
           

--
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html
Reply | Threaded
Open this post in threaded view
|

Re: How to discern when like dir names exist in 2 places

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

Put this line in your file:
- -/ /var/apache2/*

On 04/13/2015 12:17 PM, Harry Putnam wrote:

>
> with these rsync  rsync [...] /var/ /dir/ rsync [...] /etc/ /dir2/
>
> And exclude file: excl
>
> /apache2/*
>
> That will exclude both /var/apache2/* and
> /etc/apache2/*
>
> How can I tell rsync I want /var/apache2 excluded, but not
> /etc/apache2? I mean short of using separate excl files for each
> run Using something like the start of an absolute name:
> `/etc/apache2/*'
>
> Allows both /etc/apache2 and         /var/apache2  to be collected
>
>

- --
~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~
        Kevin Korb Phone:    (407) 252-6853
        Systems Administrator Internet:
        FutureQuest, Inc. [hidden email]  (work)
        Orlando, Florida [hidden email] (personal)
        Web page: http://www.sanitarium.net/
        PGP public key available on web site.
~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iEYEARECAAYFAlUr7TMACgkQVKC1jlbQAQfc3gCgk+Yq/KzfOmSbQ4X4q+hox4Xt
1ukAni90msBK1WxGBxLv/aQuIIcR2K58
=RgrB
-----END PGP SIGNATURE-----
--
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html
Reply | Threaded
Open this post in threaded view
|

Re: How to discern when like dir names exist in 2 places

Harry Putnam
Kevin Korb <[hidden email]> writes:

> -/ /var/apache2/*

Thanks for the input, but unless I'm doing something else screwy, that
does not appear to work here.

I put your line verbatim into my exlcude file (near the top)

  /pkg/*
  /sadm/*
  /cache/*
  /opt/csw/cache/*
  -/ /var/apache2/*
  /tmp/*
-------       -------       ---=---       -------       -------

My actual task here is an rsnapshot run that collects files

   Here      /var/
   and here  /etc/
   (a few other places as well as well)

But as you probably know its really a pair of rsync runs that
occur.

To reiterate, my goal was to collect files at `/etc/apache2/'
but not at `/var/apache2'

(These are just typical of what I want to do in several places.)


Adding that line verbatim did not have the effect I'm after.

--
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html
Reply | Threaded
Open this post in threaded view
|

Re: How to discern when like dir names exist in 2 places

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

Hmmm,  according to my interpretation of the man page (I am on 3.1.1)
that is supposed to work however when I test using the "-/
/etc/passwd" example the / seems to have the same effect as commenting
the line.  I get /etc/passwd copied whether the source is / or /etc.

Am I completely misunderstanding what the man page is telling me this
syntax does?

On 04/13/2015 12:44 PM, Harry Putnam wrote:

> Kevin Korb <[hidden email]> writes:
>
>> -/ /var/apache2/*
>
> Thanks for the input, but unless I'm doing something else screwy,
> that does not appear to work here.
>
> I put your line verbatim into my exlcude file (near the top)
>
> /pkg/* /sadm/* /cache/* /opt/csw/cache/* -/ /var/apache2/* /tmp/*
> -------       -------       ---=---       -------       -------
>
> My actual task here is an rsnapshot run that collects files
>
> Here      /var/ and here  /etc/ (a few other places as well as
> well)
>
> But as you probably know its really a pair of rsync runs that
> occur.
>
> To reiterate, my goal was to collect files at `/etc/apache2/' but
> not at `/var/apache2'
>
> (These are just typical of what I want to do in several places.)
>
>
> Adding that line verbatim did not have the effect I'm after.
>

- --
~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~
        Kevin Korb Phone:    (407) 252-6853
        Systems Administrator Internet:
        FutureQuest, Inc. [hidden email]  (work)
        Orlando, Florida [hidden email] (personal)
        Web page: http://www.sanitarium.net/
        PGP public key available on web site.
~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iEYEARECAAYFAlUr9dsACgkQVKC1jlbQAQcnmgCfX6AgAv6b9aASd8BuFEQFXgwA
3oIAn0dETXuHLQIFSMTgooBSjKAeHPAT
=pBTl
-----END PGP SIGNATURE-----
--
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html
Reply | Threaded
Open this post in threaded view
|

Re: How to discern when like dir names exist in 2 places

Francis.Montagnac-2

Hi,

On Mon, 13 Apr 2015 12:59:07 -0400 Kevin Korb wrote:
> Hmmm,  according to my interpretation of the man page (I am on 3.1.1)
> that is supposed to work however when I test using the "-/
> /etc/passwd" example the / seems to have the same effect as commenting
> the line.  I get /etc/passwd copied whether the source is / or /etc.

I guess that this -/ syntax is not usable with --exclude, but only
with --filter.

Try thus to modify your exclude file to:

  - /pkg/*
  - /sadm/*
  - /cache/*
  - /opt/csw/cache/*
  -/ /var/apache2/*
  - /tmp/*

an call rsync ... --filter='merge YOUR_FILE'

Francis
--
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html
Reply | Threaded
Open this post in threaded view
|

Re: How to discern when like dir names exist in 2 places

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

I was actually in the include/exclude section of the man page not the
filter section.  However, your syntax does work.

The +/- syntax absolutely works in an --exclude-from or --include-from
file I use it all the time.  However, apparently the -/ syntax does
not work there.

So, I am not sure if the man page is wrong or if this feature just
isn't working correctly in an exclude file.

- From the man page:
INCLUDE/EXCLUDE PATTERN RULES
...
The following modifiers are accepted after a "+" or "-":

 o A  /  specifies that the include/exclude rule should be matched
against the absolute pathname of the current item.  For example, "-/
/etc/passwd" would exclude the passwd file any time the transfer was
sending files from the "/etc"  directory,  and  "-/ subdir/foo" would
always exclude "foo" when it is in a dir named "subdir", even if "foo"
is at the root of the current transfer.


On 04/13/2015 01:34 PM, [hidden email] wrote:

>
> Hi,
>
> On Mon, 13 Apr 2015 12:59:07 -0400 Kevin Korb wrote:
>> Hmmm,  according to my interpretation of the man page (I am on
>> 3.1.1) that is supposed to work however when I test using the
>> "-/ /etc/passwd" example the / seems to have the same effect as
>> commenting the line.  I get /etc/passwd copied whether the source
>> is / or /etc.
>
> I guess that this -/ syntax is not usable with --exclude, but only
> with --filter.
>
> Try thus to modify your exclude file to:
>
> - /pkg/* - /sadm/* - /cache/* - /opt/csw/cache/* -/ /var/apache2/*
> - /tmp/*
>
> an call rsync ... --filter='merge YOUR_FILE'
>
> Francis
>

- --
~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~
        Kevin Korb Phone:    (407) 252-6853
        Systems Administrator Internet:
        FutureQuest, Inc. [hidden email]  (work)
        Orlando, Florida [hidden email] (personal)
        Web page: http://www.sanitarium.net/
        PGP public key available on web site.
~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iEYEARECAAYFAlUsAK4ACgkQVKC1jlbQAQeCAQCeIiW4DaQHh41XAbbIRjUqUmfG
5dUAn3w7EpsV99alLhUffL/m2H69iDnU
=EL0B
-----END PGP SIGNATURE-----
--
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html
Reply | Threaded
Open this post in threaded view
|

Re: How to discern when like dir names exist in 2 places

Francis.Montagnac-2


On Mon, 13 Apr 2015 13:45:18 -0400 Kevin Korb wrote:
> The +/- syntax absolutely works in an --exclude-from or --include-from
> file I use it all the time.  However, apparently the -/ syntax does
> not work there.

> So, I am not sure if the man page is wrong or if this feature just
> isn't working correctly in an exclude file.

This is perhaps this note in the "FILTER RULES" section:

   Note that the --include/--exclude command-line options do not allow the
   full  range  of  rule parsing as described above -- they only allow the
   specification of include/exclude patterns plus a "!" token to clear the
   list  (and the normal comment parsing when rules are read from a file).

--
Francis
--
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html
Reply | Threaded
Open this post in threaded view
|

Re: How to discern when like dir names exist in 2 places

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

Then I would say that the text I pasted is in the wrong section of the
man page and needs to be moved into the filter rules section.

On 04/13/2015 02:02 PM, [hidden email] wrote:

>
>
> On Mon, 13 Apr 2015 13:45:18 -0400 Kevin Korb wrote:
>> The +/- syntax absolutely works in an --exclude-from or
>> --include-from file I use it all the time.  However, apparently
>> the -/ syntax does not work there.
>
>> So, I am not sure if the man page is wrong or if this feature
>> just isn't working correctly in an exclude file.
>
> This is perhaps this note in the "FILTER RULES" section:
>
> Note that the --include/--exclude command-line options do not allow
> the full  range  of  rule parsing as described above -- they only
> allow the specification of include/exclude patterns plus a "!"
> token to clear the list  (and the normal comment parsing when rules
> are read from a file).
>
> -- Francis
>

- --
~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~
        Kevin Korb Phone:    (407) 252-6853
        Systems Administrator Internet:
        FutureQuest, Inc. [hidden email]  (work)
        Orlando, Florida [hidden email] (personal)
        Web page: http://www.sanitarium.net/
        PGP public key available on web site.
~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iEYEARECAAYFAlUsB8MACgkQVKC1jlbQAQdmfQCg+TCmBFtpgVR6JXLHJBbsn8Of
h+YAoKoObkYPLtWKdU+sN+vqrmUQFQGd
=xxNE
-----END PGP SIGNATURE-----
--
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html
Reply | Threaded
Open this post in threaded view
|

Re: How to discern when like dir names exist in 2 places

Harry Putnam
In reply to this post by Francis.Montagnac-2
[hidden email] writes:

> Hi,
>
> On Mon, 13 Apr 2015 12:59:07 -0400 Kevin Korb wrote:
>> Hmmm,  according to my interpretation of the man page (I am on 3.1.1)
>> that is supposed to work however when I test using the "-/
>> /etc/passwd" example the / seems to have the same effect as commenting
>> the line.  I get /etc/passwd copied whether the source is / or /etc.
>
> I guess that this -/ syntax is not usable with --exclude, but only
> with --filter.
>
> Try thus to modify your exclude file to:
>
>   - /pkg/*
>   - /sadm/*
>   - /cache/*
>   - /opt/csw/cache/*
>   -/ /var/apache2/*
>   - /tmp/*
>
> an call rsync ... --filter='merge YOUR_FILE'

I probably should have posted my OP on the rsnapshot list since that
is how this is being done here.

I did mention that early on.

I'm not sure how I would arrange to run rsync as suggested in an
rsnapshot script.

I tried this:

Comment out all mention of an exclude file

Then, where you are to set the arguments to rsync you are supposed to
give both short and long like so:

rsync_short_args  HERE
rsync_long_args   HERE

(The white space before HERE is reqiured to be a tab)

So I tried to use your suggestion by placing it in the long_arg
section like so:

-------       -------       ---=---       -------       -------
rsync_long_args   --filter="merge /etc/rsnap/ex/rsnap_2xsMisc_exclude"  --stats --delete --numeric-ids --delete-excluded
-------       -------       ---=---       -------       -------

(The file listed there (/etc/rsnap/ex/rsnap_2xsMisc_exclude) contains
your suggestion)

All those annotated like this:

  - /dir/*

Are excluded, but in both runs... that is, any files below /etc/dir/
and /var/dir/ are excluded.

the one line annotated like:

-/ /var/apache2/*

Appears to just be ignored... and any files under /etc/apache2 or
/var/apache2 are INCLUDED.


I'm beginning to get myself confused... but I suspect I should move
this query to the rsnapshot group and include a pointer to this thread.

--
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html
Reply | Threaded
Open this post in threaded view
|

Re: How to discern when like dir names exist in 2 places

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

When I was testing I had a filter file that contained:
- -/ /etc/passwd

The commands I was testing with were:
rsync -vvaiinx --filter="merge filterfile.txt" /etc/ /tmp/ | grep passwd
and
rsync -vvaiinx --filter="merge filterfile.txt" / /tmp/ | grep passwd

In both commands /etc/passwd was skipped.  With just - instead of -/
the file was only skipped on the second command.

On 04/13/2015 09:17 PM, Harry Putnam wrote:

> [hidden email] writes:
>
>> Hi,
>>
>> On Mon, 13 Apr 2015 12:59:07 -0400 Kevin Korb wrote:
>>> Hmmm,  according to my interpretation of the man page (I am on
>>> 3.1.1) that is supposed to work however when I test using the
>>> "-/ /etc/passwd" example the / seems to have the same effect as
>>> commenting the line.  I get /etc/passwd copied whether the
>>> source is / or /etc.
>>
>> I guess that this -/ syntax is not usable with --exclude, but
>> only with --filter.
>>
>> Try thus to modify your exclude file to:
>>
>> - /pkg/* - /sadm/* - /cache/* - /opt/csw/cache/* -/
>> /var/apache2/* - /tmp/*
>>
>> an call rsync ... --filter='merge YOUR_FILE'
>
> I probably should have posted my OP on the rsnapshot list since
> that is how this is being done here.
>
> I did mention that early on.
>
> I'm not sure how I would arrange to run rsync as suggested in an
> rsnapshot script.
>
> I tried this:
>
> Comment out all mention of an exclude file
>
> Then, where you are to set the arguments to rsync you are supposed
> to give both short and long like so:
>
> rsync_short_args  HERE rsync_long_args   HERE
>
> (The white space before HERE is reqiured to be a tab)
>
> So I tried to use your suggestion by placing it in the long_arg
> section like so:
>
> -------       -------       ---=---       -------       -------
> rsync_long_args   --filter="merge
> /etc/rsnap/ex/rsnap_2xsMisc_exclude"  --stats --delete
> --numeric-ids --delete-excluded -------       -------       ---=---
> -------       -------
>
> (The file listed there (/etc/rsnap/ex/rsnap_2xsMisc_exclude)
> contains your suggestion)
>
> All those annotated like this:
>
> - /dir/*
>
> Are excluded, but in both runs... that is, any files below
> /etc/dir/ and /var/dir/ are excluded.
>
> the one line annotated like:
>
> -/ /var/apache2/*
>
> Appears to just be ignored... and any files under /etc/apache2 or
> /var/apache2 are INCLUDED.
>
>
> I'm beginning to get myself confused... but I suspect I should
> move this query to the rsnapshot group and include a pointer to
> this thread.
>

- --
~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~
        Kevin Korb Phone:    (407) 252-6853
        Systems Administrator Internet:
        FutureQuest, Inc. [hidden email]  (work)
        Orlando, Florida [hidden email] (personal)
        Web page: http://www.sanitarium.net/
        PGP public key available on web site.
~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iEYEARECAAYFAlUsbH4ACgkQVKC1jlbQAQeznQCg4HYlu1npsK6xS1FxmDagCwd0
/roAn3G0Z+zd0zvCoNfqcW89/LdHCBDx
=FEAW
-----END PGP SIGNATURE-----
--
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html