Skip to content

Commit

Permalink
Auto snapshot timers are statically configured
Browse files Browse the repository at this point in the history
  • Loading branch information
jakelee8 committed Feb 19, 2017
1 parent 056f9cd commit 0378234
Show file tree
Hide file tree
Showing 11 changed files with 22 additions and 50 deletions.
57 changes: 22 additions & 35 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,40 +1,27 @@
PREFIX := /usr/local
SYSTEMD_HOME := /lib/systemd/system
SYSTEMD_HOME := $(PREFIX)/lib/systemd/system

all:
.PHONY: all

install:
install -d $(DESTDIR)/etc/cron.d
install -d $(DESTDIR)/etc/cron.daily
install -d $(DESTDIR)/etc/cron.hourly
install -d $(DESTDIR)/etc/cron.weekly
install -d $(DESTDIR)/etc/cron.monthly
install -m 0644 etc/zfs-auto-snapshot.cron.frequent $(DESTDIR)/etc/cron.d/zfs-auto-snapshot
install etc/zfs-auto-snapshot.cron.hourly $(DESTDIR)/etc/cron.hourly/zfs-auto-snapshot
install etc/zfs-auto-snapshot.cron.daily $(DESTDIR)/etc/cron.daily/zfs-auto-snapshot
install etc/zfs-auto-snapshot.cron.weekly $(DESTDIR)/etc/cron.weekly/zfs-auto-snapshot
install etc/zfs-auto-snapshot.cron.monthly $(DESTDIR)/etc/cron.monthly/zfs-auto-snapshot
install -d $(DESTDIR)$(PREFIX)/share/man/man8
install src/zfs-auto-snapshot.8 $(DESTDIR)$(PREFIX)/share/man/man8/zfs-auto-snapshot.8
install -d $(DESTDIR)$(PREFIX)/sbin
install src/zfs-auto-snapshot.sh $(DESTDIR)$(PREFIX)/sbin/zfs-auto-snapshot
install -d $(DESTDIR)$(PREFIX)/sbin $(DESTDIR)$(PREFIX)/share/man/man8
install -m 0755 src/zfs-auto-snapshot.sh $(DESTDIR)$(PREFIX)/sbin/zfs-auto-snapshot
install -m 0422 -t $(DESTDIR)$(PREFIX)/share/man/man8 src/zfs-auto-snapshot.8
install -m 0422 -t $(DESTDIR)$(SYSTEMD_HOME) \
timers/zfs-auto-snapshot-daily.service \
timers/zfs-auto-snapshot-daily.timer \
timers/zfs-auto-snapshot-frequent.service \
timers/zfs-auto-snapshot-frequent.timer \
timers/zfs-auto-snapshot-hourly.service \
timers/zfs-auto-snapshot-hourly.timer \
timers/zfs-auto-snapshot-monthly.service \
timers/zfs-auto-snapshot-monthly.timer \
timers/zfs-auto-snapshot-weekly.service \
timers/zfs-auto-snapshot-weekly.timer \
timers/zfs-auto-snapshot.target
.PHONY: install

systemd:
install -d $(DESTDIR)$(PREFIX)$(SYSTEMD_HOME)
install timers/zfs-auto-snapshot-frequent.service $(DESTDIR)/$(SYSTEMD_HOME)/zfs-auto-snapshot-frequent.service
install timers/zfs-auto-snapshot-frequent.timer $(DESTDIR)/$(SYSTEMD_HOME)/zfs-auto-snapshot-frequent.timer
install timers/zfs-auto-snapshot-hourly.service $(DESTDIR)/$(SYSTEMD_HOME)/zfs-auto-snapshot-hourly.service
install timers/zfs-auto-snapshot-hourly.timer $(DESTDIR)/$(SYSTEMD_HOME)/zfs-auto-snapshot-hourly.timer
install timers/zfs-auto-snapshot-daily.service $(DESTDIR)/$(SYSTEMD_HOME)/zfs-auto-snapshot-daily.service
install timers/zfs-auto-snapshot-daily.timer $(DESTDIR)/$(SYSTEMD_HOME)/zfs-auto-snapshot-daily.timer
install timers/zfs-auto-snapshot-weekly.service $(DESTDIR)/$(SYSTEMD_HOME)/zfs-auto-snapshot-weekly.service
install timers/zfs-auto-snapshot-weekly.timer $(DESTDIR)/$(SYSTEMD_HOME)/zfs-auto-snapshot-weekly.timer
install timers/zfs-auto-snapshot-monthly.service $(DESTDIR)/$(SYSTEMD_HOME)/zfs-auto-snapshot-monthly.service
install timers/zfs-auto-snapshot-monthly.timer $(DESTDIR)/$(SYSTEMD_HOME)/zfs-auto-snapshot-monthly.timer
install timers/zfs-auto-snapshot.target $(DESTDIR)$(PREFIX)$(SYSTEMD_HOME)/zfs-auto-snapshot.target
install -d $(DESTDIR)$(PREFIX)/share/man/man8
install src/zfs-auto-snapshot.8 $(DESTDIR)$(PREFIX)/share/man/man8/zfs-auto-snapshot.8
install -d $(DESTDIR)$(PREFIX)/sbin
install src/zfs-auto-snapshot.sh $(DESTDIR)$(PREFIX)/sbin/zfs-auto-snapshot
systemctl enable zfs-auto-snapshot.target
systemctl daemon-reload
systemctl start zfs-auto-snapshot.target
enable:
systemctl enable --now zfs-auto-snapshot.target
.PHONY: enable
Empty file modified etc/zfs-auto-snapshot.cron.daily
100755 → 100644
Empty file.
Empty file modified etc/zfs-auto-snapshot.cron.frequent
100755 → 100644
Empty file.
Empty file modified etc/zfs-auto-snapshot.cron.hourly
100755 → 100644
Empty file.
Empty file modified etc/zfs-auto-snapshot.cron.monthly
100755 → 100644
Empty file.
Empty file modified etc/zfs-auto-snapshot.cron.weekly
100755 → 100644
Empty file.
3 changes: 0 additions & 3 deletions timers/zfs-auto-snapshot-daily.timer
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,3 @@ Description=ZFS daily snapshot timer
OnCalendar=daily
Persistent=true
RandomizedDelaySec=600

[Install]
WantedBy=timers.target
3 changes: 0 additions & 3 deletions timers/zfs-auto-snapshot-frequent.timer
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,3 @@ Description=ZFS frequent snapshot timer
OnCalendar=*:0/15
Persistent=true
RandomizedDelaySec=60

[Install]
WantedBy=timers.target
3 changes: 0 additions & 3 deletions timers/zfs-auto-snapshot-hourly.timer
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,3 @@ Description=ZFS hourly snapshot timer
OnCalendar=hourly
Persistent=true
RandomizedDelaySec=59

[Install]
WantedBy=timers.target
3 changes: 0 additions & 3 deletions timers/zfs-auto-snapshot-monthly.timer
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,3 @@ Description=ZFS monthly snapshot timer
OnCalendar=monthly
Persistent=true
RandomizedDelaySec=600

[Install]
WantedBy=timers.target
3 changes: 0 additions & 3 deletions timers/zfs-auto-snapshot-weekly.timer
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,3 @@ Description=ZFS weekly snapshot timer
OnCalendar=weekly
Persistent=true
RandomizedDelaySec=600

[Install]
WantedBy=timers.target

0 comments on commit 0378234

Please sign in to comment.