SearchFAQMemberlist Log in
Reply to topic Page 1 of 1
Patch to run all intervals in one go
Author Message
Post Patch to run all intervals in one go 
Here's a patch which addresses a very old itch of mine:
I wanted just one invocation to get the backup
and all necessary rotations in one go.
This is useful for desktops and laptops,
which do not run 24x7 and frequently miss rotations otherwise.

The new command "all" checks all intervals from oldest to newest
for need of rotation and then runs the actual backup interval.
Say you have defined interval weekly 4 and interval monthly 12,
then cmd 'monthly' will run as soon as monthly.0 is 30 days older
than weekly.3 - or it if does not exist at all.
Then all faster rotations run, then the actual backup.
This ensures there never will be gaps in your intervals
and you are independent from your uptimes.

Open issues:
The script tries to derive the time periods from the interval names.
There may be expressions I missed, or the name is not time based
or it is not in English.
For these cases, the interval durations should be configurable.
E.g. French:
interval horaire 24 3600
interval quotidienne 7 86400
But this would require more changes to the core script.


Hope this is useful to others,
Peter Klausner
___________________________________________________________
Schon gehört? WEB.DE hat einen genialen Phishing-Filter in die
Toolbar eingebaut! http://produkte.web.de/go/toolbar

------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
rsnapshot-discuss mailing list
rsnapshot-discuss < at > lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rsnapshot-discuss

Post Patch to run all intervals in one go 
Hallo,

Am Dienstag, 7. Juni 2011 00:50 schrieb Peter Klausner:
Here's a patch which addresses a very old itch of mine:
I wanted just one invocation to get the backup
and all necessary rotations in one go.
This is useful for desktops and laptops,
which do not run 24x7 and frequently miss rotations otherwise.

I solved the same problem using a wrapper script and wrote 9/1/2010 12:09:

do-rsnapshots: intelligent and fully automatic management for the rsnapshot
folders hourly daily weekly monthly yearly


I use rsnapshot since 2006 with Suse Linux at my desktop and are very happy
to have it..
Many thanks to the developers.


Since 2010 I have a laptop with Suse Linux 11.2 use rsnapshot-1.3.1.

I have in rsnapshot.conf

interval        hourly  8
interval        daily   7
interval        weekly  4
interval        monthly 12
interval        yearly  100

because I want to hold on my old data.

In the crontab should be

0 * * * *         /usr/bin/rsnapshot hourly

50 23 * * *         /usr/bin/rsnapshot daily

40 23 * * 6         /usr/bin/rsnapshot weekly

30 23 1 * *         /usr/bin/rsnapshot monthly

20 23 1 1 *         /usr/bin/rsnapshot yearly

Since the laptop is not always running, its very unsure when the daily
weekly monthly and yearly backups are made.
If it is not running after 23:00, there is no rsnapshot daily weekly monthly
oder yearly.


Therefore I wrote do-rsnapshots, that calls rsnapshot as needed.

In the crontab now is only

0 * * * *         /usr/bin/do-rsnapshots


do-rsnapshots first reads the rsnapshot configuration file and then knows
how many updates should be there for each of daily weekly monthly or
yearly.

Then it looks for the last monthly folder. If it exists, it looks for
yearly.0. If that does not exist or is not made in the same year as the
oldest monthly folder, rsnapshot yearly is called with all options from the
command line of do-rsnapshots.

The same is done with monthly weekly and daily.

At last it calls (rsnapshot sync if activated and) rsnapshot hourly with all
options from the command line of do-rsnapshots.


So the backup folders are automatically build and managed.

Since all the actual work is done by rsnapshot, I hope, there are no new
bugs (exception see below).

It is also possible, to do different things.

If you want to have one daily update for a whole year (huh Smile and then only
the yearly ones, you ought to have in rsnapshot.conf

interval        daily   366
interval        yearly  100

it all goes automatically with

0 14 * * *         /usr/bin/do-rsnapshots

in crontab. But I didn't test that. Wink


This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your option)
any later version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
more details.


REQUIREMENTS:
You have to use only some of the the known interval names hourly, daily,
weekly, monthly and yearly.
Of course the bash has to be installed, also grep and the coreutils for cat
and cut.


KNOWN BUGS
I didn't implement the args in man rsnapshot
SYNOPSIS
       rsnapshot [-vtxqVD] [-c cfgfile] [command] [args]


With kind regards!
Rolf Muth

Key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xF8DC41935544C89A


------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
rsnapshot-discuss mailing list
rsnapshot-discuss < at > lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rsnapshot-discuss

Post Patch to run all intervals in one go 
Oops.
A last minute change to demote verbosity throws a warning!
Fixed that and tied one more print_msg to -v
in order to have a quiet normal run.
Please ignore the first patch.

Peter Klausner
___________________________________________________________
Schon gehört? WEB.DE hat einen genialen Phishing-Filter in die
Toolbar eingebaut! http://produkte.web.de/go/toolbar

------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
rsnapshot-discuss mailing list
rsnapshot-discuss < at > lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rsnapshot-discuss

Post Patch to run all intervals in one go 
Hi Ralf

Your wrapper script surely is the best option where you
don't want touch (and possibly break) rsnapshot itself.

I actually had considered a sh wrapper, but figured that
parsing the config and doing the arithmetics is too much effort
for me using Bourne.
You proved otherwise with some fancy bash tricks...

Still, it would be the most convenient if stock rsnapshot could do it.

Kind regars,
Peter Klausner

___________________________________________________________
Schon gehört? WEB.DE hat einen genialen Phishing-Filter in die
Toolbar eingebaut! http://produkte.web.de/go/toolbar

------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
rsnapshot-discuss mailing list
rsnapshot-discuss < at > lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rsnapshot-discuss

Post Patch to run all intervals in one go 
Hallo Peter,

(to the list only Wink

Am Dienstag, 7. Juni 2011 11:02 schrieb Peter Klausner:

Your wrapper script surely is the best option where you
don't want touch (and possibly break) rsnapshot itself.

That was exactly the reason to do it this way ...
And it runs on my desktop with rsnapshot 1.2.9, on my and my sisters laptop
with rsnapshot 1.3.1

I actually had considered a sh wrapper, but figured that
parsing the config and doing the arithmetics is too much effort
for me using Bourne.
You proved otherwise with some fancy bash tricks...

Thanks! That grew nearly without any effort, when I had to do a lot of man
bash.

Still, it would be the most convenient if stock rsnapshot could do it.

For me too, but I cannot do it, because lack of knowing pearl.

--
Herzliche GrĂŒĂŸe!
Rolf Muth

Meine Adressen duerfen nicht fuer Werbung verwendet werden! PGP Public Key:
http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xF8DC41935544C89A
Analoge Uhr (clock): http://www.heise.de/software/download/analoge_uhr/61872

------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
rsnapshot-discuss mailing list
rsnapshot-discuss < at > lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rsnapshot-discuss

Display posts from previous:
Reply to topic Page 1 of 1
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
  


Magic SEO URL for phpBB