1 |
On Mon, 09 Jan 2012 13:10:50 +0100 |
2 |
Daniel Troeder <daniel@×××××××××.com> wrote: |
3 |
|
4 |
> Hi :) |
5 |
> |
6 |
> It seems I don't understand something about cron(tab). Can someone |
7 |
> help me pls: |
8 |
> |
9 |
> I want to run flexbackup with the following backup plan: |
10 |
> * monthly full |
11 |
> * weekly diff |
12 |
> * daily incr |
13 |
> |
14 |
> So I have installed sys-process/vixie-cron-4.1-r12 (and virtual/cron-0 |
15 |
> and sys-process/cronbase-0.3.3). |
16 |
> |
17 |
> My crontab (created with "crontab -e") contains: |
18 |
> |
19 |
> 00 03 2-31 * 1-6 /usr/bin/flexbackup -set root -level incremental |
20 |
> 00 03 2-31 * 0 /usr/bin/flexbackup -set root -level differential |
21 |
> 00 03 1 * * /usr/bin/flexbackup -set root -level full |
22 |
> |
23 |
> The problem I'm facing is, that incr and diff are executed each day |
24 |
> _both_ at the same time (which flexbackup luckily handles well). |
25 |
> |
26 |
> From my understanding the 2nd line (diff) should only be run on |
27 |
> sundays, and the 1st line (inc) should not run sundays. |
28 |
> |
29 |
> |
30 |
> Can someone please explain me what I'm doing wrong? |
31 |
|
32 |
You are combining fields 3 and 5, those two work funny. |
33 |
|
34 |
Unlike the other datetime specs, they are not ANDed, they are ORed. |
35 |
|
36 |
Taking the first one, you obviously want the cron to run at 3 am |
37 |
between the 2nd and 31st of the month AND if the day is Mon-Sat. |
38 |
|
39 |
What it is doing is running at 3am every day between the 2nd and 31st |
40 |
and also every day Mon-Sat (even if that is the 1st of the month). |
41 |
|
42 |
Vixie cron does not directly allow you to do what you want. It's |
43 |
designed to run things periodically on a set schedule and doesn't do |
44 |
"except" very well. |
45 |
|
46 |
A better approach would be to fire off a wrapper script every day at |
47 |
3am. This script will then check for date, time and day of week and |
48 |
launch the app with the appropriate options. |
49 |
|
50 |
> |
51 |
> Thank you, |
52 |
> Daniel |
53 |
> |
54 |
|
55 |
|
56 |
|
57 |
-- |
58 |
Alan McKinnnon |
59 |
alan.mckinnon@×××××.com |