#!/bin/sh

dosnap() {
for  ZPOOL in ${1}
do
	/usr/sbin/zfsnap snapshot -r -z -a 7d ${ZPOOL}
	/usr/sbin/zfsnap destroy -vD ${ZPOOL}/tmp
	/usr/sbin/zfsnap destroy -v -r ${ZPOOL}
done
}

LISTA=${1:-NADA}

case $LISTA in
NADA)
	set $(zpool status)
	while [ $# -gt 0 ]
	do
		case $1 in
		pool:)
			dosnap $2
		;;
		esac
		shift
	done
;;
*)
	echo dosnap ${LISTA}
;;
esac
