added config to manage keep for every cron

This commit is contained in:
2026-10-10 17:40:44 +02:00
parent 781e133477
commit 902154001a
8 changed files with 43 additions and 10 deletions

View File

@@ -1,18 +1,27 @@
.PHONY: all install uninstall
# Load retention configuration (KEEP_FREQUENT, KEEP_HOURLY, KEEP_DAILY, KEEP_WEEKLY, KEEP_MONTHLY)
include zfs-auto-snapshot.conf
all:
# Install or update cron files with configured retention values
install:
install -d /etc/cron.d
install -d /etc/cron.daily
install -d /etc/cron.hourly
install -d /etc/cron.weekly
install -d /etc/cron.monthly
install -m 0644 etc/zfs-auto-snapshot.cron.frequent /etc/cron.d/zfs-auto-snapshot
install -m 0755 etc/zfs-auto-snapshot.cron.hourly /etc/cron.hourly/zfs-auto-snapshot
install -m 0755 etc/zfs-auto-snapshot.cron.daily /etc/cron.daily/zfs-auto-snapshot
install -m 0755 etc/zfs-auto-snapshot.cron.weekly /etc/cron.weekly/zfs-auto-snapshot
install -m 0755 etc/zfs-auto-snapshot.cron.monthly /etc/cron.monthly/zfs-auto-snapshot
sed 's/@KEEP_FREQUENT@/$(KEEP_FREQUENT)/g' etc/zfs-auto-snapshot.cron.frequent > /etc/cron.d/zfs-auto-snapshot
chmod 0644 /etc/cron.d/zfs-auto-snapshot
sed 's/@KEEP_HOURLY@/$(KEEP_HOURLY)/g' etc/zfs-auto-snapshot.cron.hourly > /etc/cron.hourly/zfs-auto-snapshot
chmod 0755 /etc/cron.hourly/zfs-auto-snapshot
sed 's/@KEEP_DAILY@/$(KEEP_DAILY)/g' etc/zfs-auto-snapshot.cron.daily > /etc/cron.daily/zfs-auto-snapshot
chmod 0755 /etc/cron.daily/zfs-auto-snapshot
sed 's/@KEEP_WEEKLY@/$(KEEP_WEEKLY)/g' etc/zfs-auto-snapshot.cron.weekly > /etc/cron.weekly/zfs-auto-snapshot
chmod 0755 /etc/cron.weekly/zfs-auto-snapshot
sed 's/@KEEP_MONTHLY@/$(KEEP_MONTHLY)/g' etc/zfs-auto-snapshot.cron.monthly > /etc/cron.monthly/zfs-auto-snapshot
chmod 0755 /etc/cron.monthly/zfs-auto-snapshot
install -d /usr/local/sbin
install -m 0755 src/zfs-auto-snapshot.sh /usr/local/sbin/zfs-auto-snapshot