add zfs-periodic

This commit is contained in:
ziggi
2020-01-22 18:53:46 +00:00
parent 02bd90b774
commit 0d5a7cf010
5 changed files with 91 additions and 0 deletions

View File

@@ -0,0 +1,45 @@
# Created by: Peter Ankerstal <peter@pean.org>
# $FreeBSD: head/sysutils/zfs-periodic/Makefile 407685 2016-02-01 06:27:54Z pi $
PORTNAME= zfs-periodic
PORTVERSION= 1.0.20130213
CATEGORIES= sysutils
MAINTAINER= peter@pean.org
COMMENT= Simple way of maintaining zfs snapshots using the periodic system
USE_GITHUB= yes
GH_ACCOUNT= ross
GH_TAGNAME= a481121
NO_ARCH= yes
NO_BUILD= yes
PERIODIC_DIRS+= etc/periodic/hourly
PERIODIC_DIRS+= etc/periodic/daily
PERIODIC_DIRS+= etc/periodic/weekly
PERIODIC_DIRS+= etc/periodic/monthly
PERIODIC_DIRS+= etc/periodic
PERIODIC_FILES+= etc/periodic/hourly/000.zfs-snapshot
PERIODIC_FILES+= etc/periodic/daily/000.zfs-snapshot
PERIODIC_FILES+= etc/periodic/weekly/000.zfs-snapshot
PERIODIC_FILES+= etc/periodic/monthly/000.zfs-snapshot
post-patch:
.for FILE in ${PERIODIC_FILES}
${REINPLACE_CMD} -e "s|/etc/periodic/zfs-snapshot|${PREFIX}/etc/periodic/zfs-snapshot|" \
${WRKSRC}/${FILE}
.endfor
do-install:
.for DIR in ${PERIODIC_DIRS}
${MKDIR} ${STAGEDIR}${PREFIX}/${DIR}
.endfor
${INSTALL_SCRIPT} ${WRKSRC}/etc/periodic/zfs-snapshot ${STAGEDIR}${PREFIX}/etc/periodic/
.for FILE in ${PERIODIC_FILES}
${INSTALL_SCRIPT} ${WRKSRC}/${FILE} ${STAGEDIR}${PREFIX}/${FILE}
.endfor
.include <bsd.port.mk>

View File

@@ -0,0 +1,2 @@
SHA256 (ross-zfs-periodic-1.0.20130213-a481121_GH0.tar.gz) = e0d12bb3ff466e3aaabd09c2b9685b5e5ee5f91e0d62126c05ba33c60a7b9a9b
SIZE (ross-zfs-periodic-1.0.20130213-a481121_GH0.tar.gz) = 2527

View File

@@ -0,0 +1,4 @@
Scripts that uses the periodic system to create and manage zfs
snapshots. Easily configured via /etc/periodic.conf
WWW: https://github.com/ross/zfs-periodic

View File

@@ -0,0 +1,30 @@
[
{ type: install
message: <<EOM
In order to enable periodic snapshots you need
to add these lines to your /etc/periodic.conf
hourly_output="root"
hourly_show_success="NO"
hourly_show_info="YES"
hourly_show_badconfig="NO"
hourly_zfs_snapshot_enable="YES"
hourly_zfs_snapshot_pools="tank"
hourly_zfs_snapshot_keep=6
daily_zfs_snapshot_enable="YES"
daily_zfs_snapshot_pools="tank"
daily_zfs_snapshot_keep=7
weekly_zfs_snapshot_enable="YES"
weekly_zfs_snapshot_pools="tank"
weekly_zfs_snapshot_keep=5
monthly_zfs_snapshot_enable="YES"
monthly_zfs_snapshot_pools="tank"
monthly_zfs_snapshot_keep=2
To get hourly snapshots you also need to add
something like this to /etc/crontab:
2 * * * * root periodic hourly
EOM
}
]

View File

@@ -0,0 +1,10 @@
etc/periodic/daily/000.zfs-snapshot
etc/periodic/hourly/000.zfs-snapshot
etc/periodic/monthly/000.zfs-snapshot
etc/periodic/weekly/000.zfs-snapshot
etc/periodic/zfs-snapshot
@dir etc/periodic/daily
@dir etc/periodic/hourly
@dir etc/periodic/monthly
@dir etc/periodic/weekly
@dir etc/periodic