From 4b7609791b66ad1a8d9a2aaf378c99970248d5f4 Mon Sep 17 00:00:00 2001 From: Darik Horn Date: Fri, 25 Nov 2011 10:51:03 -0600 Subject: [PATCH] Split the cron file for anacron compatibilty. Split the cron file so that the hourly, daily, weekly, and monthly zfs automatic snapshots still happen even if the system is offline temporarily during the scheduled event, such as during a reboot. On Debian systems, if anacron is installed, then it is used to run the /etc/cron.{hourly,daily,weekly,monthly} directories, but not the /etc/cron.d directory. This means that /etc/cron.d jobs are not run if the system is offline when crond would usually invoke them. --- Makefile | 10 +++++++++- etc/zfs-auto-snapshot.cron.daily | 2 ++ ...o-snapshot.cron => zfs-auto-snapshot.cron.frequent} | 0 etc/zfs-auto-snapshot.cron.hourly | 2 ++ etc/zfs-auto-snapshot.cron.monthly | 2 ++ etc/zfs-auto-snapshot.cron.weekly | 2 ++ 6 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 etc/zfs-auto-snapshot.cron.daily rename etc/{zfs-auto-snapshot.cron => zfs-auto-snapshot.cron.frequent} (100%) create mode 100644 etc/zfs-auto-snapshot.cron.hourly create mode 100644 etc/zfs-auto-snapshot.cron.monthly create mode 100644 etc/zfs-auto-snapshot.cron.weekly diff --git a/Makefile b/Makefile index 30d73e8..ba36795 100644 --- a/Makefile +++ b/Makefile @@ -2,6 +2,14 @@ all: install: install -d $(DESTDIR)$(PREFIX)/etc/cron.d - install etc/zfs-auto-snapshot.cron $(DESTDIR)$(PREFIX)/etc/cron.d/zfs-auto-snapshot + install -d $(DESTDIR)$(PREFIX)/etc/cron.daily + install -d $(DESTDIR)$(PREFIX)/etc/cron.hourly + install -d $(DESTDIR)$(PREFIX)/etc/cron.weekly + install -d $(DESTDIR)$(PREFIX)/etc/cron.monthly + install etc/zfs-auto-snapshot.cron.frequent $(DESTDIR)$(PREFIX)/etc/cron.d/zfs-auto-snapshot + install etc/zfs-auto-snapshot.cron.hourly $(DESTDIR)$(PREFIX)/etc/cron.daily/zfs-auto-snapshot + install etc/zfs-auto-snapshot.cron.daily $(DESTDIR)$(PREFIX)/etc/cron.hourly/zfs-auto-snapshot + install etc/zfs-auto-snapshot.cron.weekly $(DESTDIR)$(PREFIX)/etc/cron.weekly/zfs-auto-snapshot + install etc/zfs-auto-snapshot.cron.monthly $(DESTDIR)$(PREFIX)/etc/cron.monthly/zfs-auto-snapshot install -d $(DESTDIR)$(PREFIX)/sbin install src/zfs-auto-snapshot.sh $(DESTDIR)$(PREFIX)/sbin/zfs-auto-snapshot diff --git a/etc/zfs-auto-snapshot.cron.daily b/etc/zfs-auto-snapshot.cron.daily new file mode 100644 index 0000000..fab4e7f --- /dev/null +++ b/etc/zfs-auto-snapshot.cron.daily @@ -0,0 +1,2 @@ +#!/bin/sh +exec zfs-auto-snapshot --quiet --syslog --label=daily --keep=31 // diff --git a/etc/zfs-auto-snapshot.cron b/etc/zfs-auto-snapshot.cron.frequent similarity index 100% rename from etc/zfs-auto-snapshot.cron rename to etc/zfs-auto-snapshot.cron.frequent diff --git a/etc/zfs-auto-snapshot.cron.hourly b/etc/zfs-auto-snapshot.cron.hourly new file mode 100644 index 0000000..dc39e11 --- /dev/null +++ b/etc/zfs-auto-snapshot.cron.hourly @@ -0,0 +1,2 @@ +#!/bin/sh +exec zfs-auto-snapshot --quiet --syslog --label=hourly --keep=24 // diff --git a/etc/zfs-auto-snapshot.cron.monthly b/etc/zfs-auto-snapshot.cron.monthly new file mode 100644 index 0000000..27e2ead --- /dev/null +++ b/etc/zfs-auto-snapshot.cron.monthly @@ -0,0 +1,2 @@ +#!/bin/sh +exec zfs-auto-snapshot --quiet --syslog --label=monthly --keep=12 // diff --git a/etc/zfs-auto-snapshot.cron.weekly b/etc/zfs-auto-snapshot.cron.weekly new file mode 100644 index 0000000..77e5a15 --- /dev/null +++ b/etc/zfs-auto-snapshot.cron.weekly @@ -0,0 +1,2 @@ +#!/bin/sh +exec zfs-auto-snapshot --quiet --syslog --label=weekly --keep=4 //