Re: cron questions

Miek Gieben <[email protected]>
Newsgroups gmane.comp.sysutils.backup.hdup.general
Message-ID <[email protected]>
[On 19 Dec, @01:22, Josh wrote in "[hdup-user] cron questions ..."]
> In Nathan G. Grennan's original post with his cron configuration:
> 
>   http://article.gmane.org/gmane.comp.sysutils.backup.hdup.general/39
> 
> he skips running the weekly and daily on the first of the month and, 
> similarly, skips running the dailys on the days that the weeklys run;
> 
> # Monthly backup
> 0 0 1 * * root /usr/local/sbin/bmonth news
> # Weekly backup
> 0 0 7,14,21,28 * 0 root /usr/local/sbin/bweek news
> # Daily backup
> 0 0 2,3,4,5,6,8,9,10,11,12,13,15,16,17,18,19,20,22,23,24,25,26,27,29,30,31 * * root /usr/local/sbin/bday news
> 
> in the examples/ directory of the hdup tarball the hdup.cron has all of
> these days that were previously excluded, well, included:
> 
> # --- start of new backup season --- #
> 00 02 1 * * root /usr/local/sbin/hdup -q -q monthly host
> # --- the weekly --- #
> 00 04 1,7,14,21,28 * * root /usr/local/sbin/hdup -q -q weekly host
> # --- the daily --- #
> 00 06 1-31 * * root /usr/local/sbin/hdup -q -q daily host
> 
> Now, technically, I could see either as being perfectly valid but... I see
> some problems with the latter (the one included in examples/hdup.cron).
> For example, if the timing of the monthly, weekly, and dailys is set just
> right so that each finishes before the other then you're probably alright.

I think i've seen this happening. Usually cron would send me a mail the next
day complaining "about not being able to find the monthly". Maybe that is
triggered by this race.

> But if not, won't what is backed up be somewhat non-deterministic and,
> worse, possible wrong?  For example, say it is the 7th and the daily
> starts while the weekly is still going -- what will be backed up?  Or,

whenever a backup for a host is running a LOCK file is created. If other 
(incremental) backup are started they will abort due to the LOCK file.
So hdup quits.

> worst case, it is the 1st of the month... the monthly starts...before it 
> completes the weekly starts...and before it completes the daily starts.  
> 
> I suppose I could have one script that I run, starting each right after
> the other -- thus guaranteeing each can't start until the prior one
> completes.  Or I could do it the way that it was suggested by Nathan in
> the first post (which I presume the example cron script is based on).  The
> main difference, I think, would be differing version history.
> 
> Thinking about it I suppose I do want to run all of these from one script
> to (a) make the order deterministic (b) better tweak the ordering for
> version control if I, say, wanted the daily on the 7th to be done before
> the new weekly gets done.

be my guest, I will be happy to include it in crontrib/
This one of those things that should get fiex properly, but (I think) don't 
belong in hdup itself.

> Thoughts?  What are others doing?

keeping my fingers crossed every 1st of the monthy ;-) However, the monthly
dump is _always_ made. And if you use 'always backup = yes' in subsequent
dumps hdup will try to make missing weekly's.... so...

If (for now) changed the times in the example cron script. So that the monthly
has 4 hours to complete.

grtz Miek
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.