1 |
On 21/04/2013 20:47, Tanstaafl wrote: |
2 |
> Ok, my goal is to keep 3 'snapshots' per day (11:30am, 2:30pm and |
3 |
> 5:30pm), 7 daily's (8:50pm), 4 weekly's (8:40pm), 12 monthly's (8:30pm), |
4 |
> and 5 yearly's (8:20pm). |
5 |
> |
6 |
> My myhost1.conf has: |
7 |
> |
8 |
> interval hourly 3 |
9 |
> interval daily 7 |
10 |
> interval weekly 4 |
11 |
> interval monthly 12 |
12 |
> interval yearly 5 |
13 |
> |
14 |
> And my /etc/crontab now looks like: |
15 |
> |
16 |
>> # for vixie cron |
17 |
>> # $Header: |
18 |
>> /var/cvsroot/gentoo-x86/sys-process/vixie-cron/files/crontab-3.0.1-r4,v 1.3 |
19 |
>> 2011/09/20 15:13:51 idl0r Exp $ |
20 |
>> |
21 |
>> # Global variables |
22 |
>> SHELL=/bin/bash |
23 |
>> PATH=/sbin:/bin:/usr/sbin:/usr/bin |
24 |
>> MAILTO=root |
25 |
>> HOME=/ |
26 |
>> |
27 |
>> # check scripts in cron.hourly, cron.daily, cron.weekly and cron.monthly |
28 |
>> 59 * * * * root rm -f /var/spool/cron/lastrun/cron.hourly |
29 |
>> 9 3 * * * root rm -f /var/spool/cron/lastrun/cron.daily |
30 |
>> 19 4 * * 6 root rm -f /var/spool/cron/lastrun/cron.weekly |
31 |
>> 29 5 1 * * root rm -f /var/spool/cron/lastrun/cron.monthly |
32 |
>> */10 * * * * root test -x /usr/sbin/run-crons && |
33 |
>> /usr/sbin/run-crons |
34 |
>> # |
35 |
>> # rsnapshot cronjobs |
36 |
>> # |
37 |
>> 30 11,14,17 * * * root rsnapshot -c /etc/rsnapshot/myhost1.conf |
38 |
>> sync; rsnapshot -c /etc/rsnapshot/myhost1.conf hourly |
39 |
>> 50 20 * * * root rsnapshot -c /etc/rsnapshot/myhost1.conf daily |
40 |
>> 40 20 * * 6 root rsnapshot -c /etc/rsnapshot/myhost1.conf weekly |
41 |
>> 30 20 1 * * root rsnapshot -c /etc/rsnapshot/myhost1.conf monthly |
42 |
>> 20 20 1 * * root rsnapshot -c /etc/rsnapshot/myhost1.conf yearly |
43 |
|
44 |
Only the last line is wrong - your monthly and yearly are equivalent.To |
45 |
be properly yearly, you need a month value in field 4. |
46 |
|
47 |
I'm not familiar with rsnapshot, I assume that package can deal with how |
48 |
many of each type of snapshot to retain in it's conf file? I see no |
49 |
crons to delete out of date snapshots. |
50 |
|
51 |
|
52 |
And, more as a nitpick than anything else, I always recommend that when |
53 |
a sysadmin adds a root cronjob, use crontab -e so it goes in |
54 |
/var/spool/cron, not /etc/crontab. Two benefits: |
55 |
|
56 |
- syntax checking when you save and quit |
57 |
- if you let portage, package managers, chef, puppet or whatever manage |
58 |
your global cronjobs in /etc/portage, then there's no danger that system |
59 |
will trash the stuff that you added there manually. |
60 |
|
61 |
-- |
62 |
Alan McKinnon |
63 |
alan.mckinnon@×××××.com |