12.9.06

 

Remote cleanup patch for ZFS Auto-Snapshot

This patch cleans up remote snapshots. Use with zfs-snapshot version 0.6. Thanks Tim for this great utility!

#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License, Version 1.0 only
# (the "License"). You may not use this file except in compliance
# with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
# Version 0.1
# This patch adds the backup destroy functionality to zfs-auto-snapshot-0.6
#
# An additional property is needed in the manifest beside the backup-save-cmd.
# This example deletes all snapshots according to the retention policy:
#
# <propval name="backup-destroy-cmd" type="astring"
# value="/usr/bin/ssh user@host /usr/bin/pfexec /usr/sbin/zfs destroy u00/test"
# override="true"/>

281a282,284
> typeset BACKUP_DESTROY_CMD=$(svcprop -p zfs/backup-destroy-cmd $FMRI > | sed -e 's/\\//g')
>
297a301,309
>
> if [ -n "${BACKUP_DESTROY_CMD}" ]
> then
> typeset REMOTE_SNAP=${snapshot##*@}
> echo "Backup snapshot being destroyed as per retention policy."
> $($BACKUP_DESTROY_CMD@$REMOTE_SNAP)
> check_failure $? "Unable to destroy remote snapshot"
> fi

This page is powered by Blogger. Isn't yours?