Is there a parameter in rsync to clean $BACKUPDIR before writing to it (--backup-dir=$BACKUPDIR)?

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

Is there a parameter in rsync to clean $BACKUPDIR before writing to it (--backup-dir=$BACKUPDIR)?

jupiter.hce
Hi,

I am runing rsync --backup --backup-dir=$BACKUPDIR where the BACKUPDIR=$(date +%d) to recycle the $BACKUPDIR in a month. But rsync does not clean the  $BACKUPDIR before writing to it in cycling.

I guess you have to clean it manually before the rsync can write to it. As my $BACKUPDIR is in remote machine, do you have to run ssh to delete it first before calling rsync in a script? Or if there is better parameter in rsync to automatically delete the old $BACKUPDIR, and create a new one?

Thank you.

- j

--
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: Is there a parameter in rsync to clean $BACKUPDIR before writing to it (--backup-dir=$BACKUPDIR)?

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

Obviously you can ssh an rm -rf.  Alternatively, if you are in a
restricted environment where you are only allowed to use rsync you can
rsync --delete an empty directory to it.

On 02/03/2016 08:33 PM, jupiter wrote:

> Hi,
>
> I am runing rsync --backup --backup-dir=$BACKUPDIR where the
> BACKUPDIR=$(date +%d) to recycle the $BACKUPDIR in a month. But
> rsync does not clean the  $BACKUPDIR before writing to it in
> cycling.
>
> I guess you have to clean it manually before the rsync can write to
> it. As my $BACKUPDIR is in remote machine, do you have to run ssh
> to delete it first before calling rsync in a script? Or if there is
> better parameter in rsync to automatically delete the old
> $BACKUPDIR, and create a new one?
>
> Thank you.
>
> - j
>
>

- --
~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,
        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

iEYEARECAAYFAlayq9kACgkQVKC1jlbQAQenqQCggRskPs3HgH9Xp4vB1e+1I38d
kC4AoIih2r6jd0RqKGByLncVbfVHXLUQ
=O0W8
-----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: Is there a parameter in rsync to clean $BACKUPDIR before writing to it (--backup-dir=$BACKUPDIR)?

jupiter.hce
Hi Kevin,

Thank you very much for the response. Actually, I don't think I need to clean the backup dir defined in --backup-dir=<backup dir>, when the contents has already been deleted in the destination (no exist), it will delete from the backup dir as well in next cycle, correct?

Regards,

- j


On Thu, Feb 4, 2016 at 12:39 PM, Kevin Korb <[hidden email]> wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Obviously you can ssh an rm -rf.  Alternatively, if you are in a
restricted environment where you are only allowed to use rsync you can
rsync --delete an empty directory to it.

On 02/03/2016 08:33 PM, jupiter wrote:
> Hi,
>
> I am runing rsync --backup --backup-dir=$BACKUPDIR where the
> BACKUPDIR=$(date +%d) to recycle the $BACKUPDIR in a month. But
> rsync does not clean the  $BACKUPDIR before writing to it in
> cycling.
>
> I guess you have to clean it manually before the rsync can write to
> it. As my $BACKUPDIR is in remote machine, do you have to run ssh
> to delete it first before calling rsync in a script? Or if there is
> better parameter in rsync to automatically delete the old
> $BACKUPDIR, and create a new one?
>
> Thank you.
>
> - j
>
>

- --
~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,
        Kevin Korb                      Phone:    <a href="tel:%28407%29%20252-6853" value="+14072526853" target="_blank">(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

iEYEARECAAYFAlayq9kACgkQVKC1jlbQAQenqQCggRskPs3HgH9Xp4vB1e+1I38d
kC4AoIih2r6jd0RqKGByLncVbfVHXLUQ
=O0W8
-----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


--
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: Is there a parameter in rsync to clean $BACKUPDIR before writing to it (--backup-dir=$BACKUPDIR)?

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

I don't think so but then I use --link-dest instead of --backup.

On 02/04/2016 05:11 AM, jupiter wrote:

> Hi Kevin,
>
> Thank you very much for the response. Actually, I don't think I
> need to clean the backup dir defined in --backup-dir=<backup dir>,
> when the contents has already been deleted in the destination (no
> exist), it will delete from the backup dir as well in next cycle,
> correct?
>
> Regards,
>
> - j
>
>
> On Thu, Feb 4, 2016 at 12:39 PM, Kevin Korb <[hidden email]
> <mailto:[hidden email]>> wrote:
>
> Obviously you can ssh an rm -rf.  Alternatively, if you are in a
> restricted environment where you are only allowed to use rsync you
> can rsync --delete an empty directory to it.
>
> On 02/03/2016 08:33 PM, jupiter wrote:
>> Hi,
>
>> I am runing rsync --backup --backup-dir=$BACKUPDIR where the
>> BACKUPDIR=$(date +%d) to recycle the $BACKUPDIR in a month. But
>> rsync does not clean the  $BACKUPDIR before writing to it in
>> cycling.
>
>> I guess you have to clean it manually before the rsync can write
>> to it. As my $BACKUPDIR is in remote machine, do you have to run
>> ssh to delete it first before calling rsync in a script? Or if
>> there is better parameter in rsync to automatically delete the
>> old $BACKUPDIR, and create a new one?
>
>> Thank you.
>
>> - j
>
>
>
>
> -- 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
>
>

- --
~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,
        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

iEYEARECAAYFAlazev4ACgkQVKC1jlbQAQdrfACdFsdpZ/VEVqwdm5nAKyBdKcYz
G7gAnj6c0YgXjfiSwWc2laLiOwA7oFqJ
=SD9m
-----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