#!/bin/bash if [ -z "${1}" ] ; then echo "usage: ${0} snapshot_name"; exit 1; fi snapname=`echo $1 | grep '@'` if [ $? != 0 ] ; then echo "error: snapshot name must contain a full zfs path with an '@'"; exit 1; fi zfs destroy ${snapname} echo "flush tables with read lock; system zfs snapshot ${snapname}; unlock tables;" | mysql