baklabel - see Description below
========

Version   Build Who  When/What
==============================

ver 1.0.3 2729  md  24 Aug 2012 - Code review and tweaks to test importing
                    to cater for in-house python path adjustments

ver 1.0.2 2685  md   8 Mar 2011 - Refactored guessdate() out of __main__
                     to permit string dates as a calling convenience

ver 1.0.1 2671  md   4 Nov 2010 - Minor refactoring and tidying comments

ver 1.0.0 2670  md   3 Nov 2010 - New option to append current year to
                     any month-end label, not just end-of-year.

ver 0.2.0 2664  md   27 oct 2010 - Help now respects defaults which have
                     been adjusted in the source code. A new default now
                     permits adjustment of new_year_month which sets the
                     end-of-year label to any desired month.

ver 0.1.0b 2646  md  8 oct 2010 - Added -d numeric option for setting
                     the label to x days ago. Eg., -1 = yesterday. Also
                     added a time trigger option in the -d switch such
                     that, for example, -d 3am will produce yesterday's
                     label if baklabel is called prior to 3am

ver 0.0.0a 2640  md  1 jul 2010 - first written


Description
===========
baklabel is designed for use in automated scripts to deliver a sensible
directory path fragment (or label) each day to construct a grandfathered
local backup destination. It can also be run as a stand-alone utility to
find the backup label produced for any given date and set of options.

Run  baklabel.py -h  to see command line usage options.

Call baklabel directly or import it and produce labels from your code.

Python 2.6, 2.7 and 3.x

In the docs directory after installing, see release_note.txt for more
detail on the package, instructions.txt for baklabel output examples and
backup_howto.txt for a complete example backup script for Windows.


Grandfathered Backups
=====================
Properly grandfathered, there needs to be a daily backup to one of 23
separate tapes, sets of media or local directories on a storage device.
This complement is made up of 6 weekday backups, 5 week backups and 12
month backups. 23 backups is quite economical for 12 months coverage.

This provides a stream of untouched backups for at least seven days plus
the ability to go back four or five Fridays plus having monthly snapshots
going back for twelve months. This represents real comfort when retrieving
data which has been compromised at some unknown point in the past.

Each of the regular weekday Sat to Thu backups will be overwritten seven
days later. However, if an end-of-month occurs on that weekday the month-
end backup will happen instead and the weekday backup will survive for an
extra seven days.

Four of the weekly backups get overwritten four weeks later. The fifth
Friday tape gets overwritten once in a blue moon! Whenever there are five
Fridays in a month. If end-of-month occurs on a Friday then the month-end
backup occurs and that Friday backup survives for an extra month or so
before being overwritten again.

Each month-end backup gets overwritten a year later.

Media taken off-site will not be overwritten in future so they should be
manually labeled with the actual date of the backup carried.

Here are the default labels produced by baklabel for on-site backups:

dec_2010  = 31 Dec 2010
nov       = 30 Nov
oct       = 31 Oct
sep       = 30 Sep
aug       = 31 Aug
jul       = 31 Jul
jun       = 30 Jun
may       = 31 May
apr       = 30 Apr
mar       = 31 Mar
feb       = 28 or 29 Feb
jan       = 31 Jan
mon       = day 0 of the week
tue       = day 1 of the week
wed       = day 2 of the week
thu       = day 3 of the week
fri_1,    = day 4 of the week
 fri_2,   = day 4 of the week
  fri_3,  = day 4 of the week
   fri_4, = day 4 of the week
    fri_5 = day 4 of the week
sat       = day 5 of the week
sun       = day 6 of the week

If a backup name is higher in this list than another then it will be
produced instead of the one below it.

End-of-year is usually special for archiving reasons. Otherwise it is just
another month-end. baklabel defaults to appending the year to the December
backup label. This can be undone with the '-y False' option.

Also, if the new year begins in July rather than January, for example,
use the '-n 7' option. This makes June 30 the end-of-year backup rather
than 31 December. The June label would then be 'jun_2010'.

If you prefer a different day than friday for these week-at-a-time backups
then edit the WEEKLY_DAY value to represent a different day of the week.

If you want to live dangerously you could make WEEKLY_DAY greater than or
equal to 7 and skip saving week-at-a-time backups. Not recommended.


Source:  Userid is 'public' with no password.
http://svn.pczen.com.au/repos/pysrc/gpl3/baklabel/distrib/

Mike Dewhirst
miked@dewhirst.com.au



License
=======
Copyright 2010 Mike Dewhirst

This program is free software: you can redistribute it and/or modify it
under the terms of the GNU Library or Lesser General Public License (LGPL)
as published by the Free Software Foundation.

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.

You should have received a copy of the GNU General Public License and the
GNU Library or Lesser General Public License along with this program.  If
not, see <http://www.gnu.org/licenses/>.
