[comp.unix.admin] precedence in crontabs

david@mobius.msri.org (David Mostardi) (03/02/91)

This is my backup strategy (fairly standard):
	level 9, Tues-Fri
	level 5, Sat
	level 0, 1st of the Month

The problem: one can't specify both "first of the month" and
"day of the week" in one crontab line.  So, I would need to
do it in two lines.  What are the precedence rules?  For example,
if I say this:

	0 4 1 * * /usr/etc/rdump 0ubcdsf ...
	0 4 * * 6 /usr/etc/rdump 5ubcdsf ...
	0 4 * * 2,3,4,5 /usr/etc/rdump 9ubcdsf ...

and the 1st of the month is a Wednesday, does the level 0 backup
or the level 9 backup occur?

Thanks,
David
--
******************************************************************
David Mostardi                        "Where the coffee is strong,
Systems Administrator                     the cat is good-looking, 
MSRI, Berkeley CA          and all the theorems are above-average."

jdm5548@diamond.tamu.edu (James Darrell McCauley) (03/03/91)

In article <10481@dog.ee.lbl.gov>, david@mobius.msri.org (David Mostardi) writes:
[stuff deleted]
|> 
|> 	0 4 1 * * /usr/etc/rdump 0ubcdsf ...
|> 	0 4 * * 6 /usr/etc/rdump 5ubcdsf ...
|> 	0 4 * * 2,3,4,5 /usr/etc/rdump 9ubcdsf ...
|>

I would suggest not using cron to do a level 0 dump.

I'm not sure which cron would see first, but I it would
attempt to do both dumps.  Are you using different drives for level 0 
and level 9?

If you must do this using cron, may I suggest running an sed script
on the crontab file using cron:
  0 3 1 * * remove_level_9
  0 6 1 * * add_level_9

-- 
James Darrell McCauley (jdm5548@diamond.tamu.edu, jdm5548@tamagen.bitnet)
Spatial Analysis Lab, Department of Agricultural Engineering,
Texas A&M University, College Station, Texas 77843-2117, USA

jb3o+@andrew.cmu.edu (Jon Allen Boone) (03/04/91)

You could do what we do - have cron run a backupprogram - which calls
a script which, for each machine, calls a c program to determine the
level of the dump, writes a header file (using dd) on the tape, then
does the dump to the tape, keeping a detailed log (dump's output) for
each day (the last 14 days are kept) and a not-so-detailed log (dd's
output) for general record keeping.  For 14 volumes, we do a level 0
dump every fortnight.

Or you could replace the whole schmear with a perl script to do the
whole thing for you.

-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
| Iain | jb3o@andrew.cmu.edu | iain@stat.cmu.edu | R746JB30@VB.CC.CMU.EDU |
----------------------------------|++++++++++++++++++++++++++++++++++++++++
| "He divines remedies against injuries;   | "Words are drugs."           |
|  he knows how to turn serious accidents  |     -Antero Alli             |
|  to his own advantage; whatever does not |                              |
|  kill him makes him stronger."           | "Culture is for bacteria."   |
|                   - Friedrich Nietzsche  |     - Christopher Hyatt      |
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-

shwake@raysnec.UUCP (Ray Shwake) (03/05/91)

david@mobius.msri.org (David Mostardi) writes:

>The problem: one can't specify both "first of the month" and
>"day of the week" in one crontab line.  So, I would need to
>do it in two lines.  What are the precedence rules?  For example,
>if I say this:

	Who says this level of discrimination must be conducted by cron? As
an alternative approach, consider running your backup routines through a
script which identifies day of week, day of month, etc. and acts 
accordingly. We developed such a routine years ago and it worked fine.

-----------  
uunet!media!ka3ovk!raysnec!shwake				shwake@rsxtech