1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-10-20 20:09:11 +00:00

A simple script for automatic ZFS snapshot creation and removal of stale

ones.

PR:		ports/125340
Submitted by:	Marcin Simonides <marcin@studio4plus.com>
This commit is contained in:
Wesley Shields 2008-07-16 21:30:30 +00:00
parent 4ca1d4e9a5
commit 85d2841b60
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=216935
7 changed files with 68 additions and 0 deletions

View File

@ -834,6 +834,7 @@
SUBDIR += zccron
SUBDIR += zeroer
SUBDIR += zfs-replicate
SUBDIR += zfs-snapshot-mgmt
SUBDIR += zidrav
SUBDIR += zisofs-tools

View File

@ -0,0 +1,36 @@
# New ports collection makefile for: zfs-snapshot-mgmt
# Date created: 6 July 2008
# Whom: Marcin Simonides <marcin@studio4plus.com>
#
# $FreeBSD$
#
PORTNAME= zfs-snapshot-mgmt
PORTVERSION= 20080706
CATEGORIES= sysutils
MASTER_SITES= http://marcin.studio4plus.com/files/
MAINTAINER= marcin@studio4plus.com
COMMENT= Automatic ZFS snapshot management tool
USE_RUBY= yes
RUBY_NO_BUILD_DEPENDS= yes
NO_BUILD= yes
MAN8= zfs-snapshot-mgmt.8
SUB_FILES= pkg-message
PKGMESSAGE= ${WRKDIR}/pkg-message
do-install:
@${INSTALL_SCRIPT} ${WRKSRC}/${PORTNAME} ${PREFIX}/bin
@${INSTALL_MAN} ${WRKSRC}/${PORTNAME}.8 ${MANPREFIX}/man/man8
@${INSTALL_DATA} ${WRKSRC}/${PORTNAME}.conf.sample ${PREFIX}/etc
post-install:
@if [ ! -f ${PREFIX}/etc/${PORTNAME}.conf ]; then \
${CP} -p ${PREFIX}/etc/${PORTNAME}.conf.sample ${PREFIX}/etc/${PORTNAME}.conf ; \
fi
@${CAT} ${PKGMESSAGE}
.include <bsd.port.mk>

View File

@ -0,0 +1,3 @@
MD5 (zfs-snapshot-mgmt-20080706.tar.gz) = dfba7b53d8f78cd64fd8a63682f94907
SHA256 (zfs-snapshot-mgmt-20080706.tar.gz) = 9fed502a115f43652b3e70d801f716a3f18201d1debffd0f65316aae160b8646
SIZE (zfs-snapshot-mgmt-20080706.tar.gz) = 4515

View File

@ -0,0 +1,9 @@
To actually turn on the automatic snapshots you have to do the following:
1. Add an appropriate crontab entry, e.g.:
echo "*/5 * * * * root /usr/local/bin/zfs-snapshot-mgmt" >> /etc/crontab
See zfs-snapshot-mgmt(8) manpage for more details.

View File

@ -0,0 +1,12 @@
#!/bin/sh
# $FreeBSD$
#
if [ "$2" != "POST-DEINSTALL" ]; then
exit 0
fi
echo
echo "Remember to remove zfs-snapshot-mgmt entry from cron configuration."
echo -n "Otherwise the system will be constantly trying to call the deinstalled"
echo " script."

View File

@ -0,0 +1,3 @@
A simple ruby script for automating creation and removal of ZFS snapshots.
WWW: http://marcin.studio4plus.com/en/zfs-file-history/howto.html

View File

@ -0,0 +1,4 @@
bin/zfs-snapshot-mgmt
@unexec if cmp -s %D/etc/zfs-snapshot-mgmt.conf.sample %D/etc/zfs-snapshot-mgmt.conf; then rm -f %D/etc/zfs-snapshot-mgmt.conf; fi
etc/zfs-snapshot-mgmt.conf.sample
@exec if [ ! -f %D/etc/zfs-snapshot-mgmt.conf ] ; then cp -p %D/%F %B/zfs-snapshot-mgmt.conf; fi