}
trap cleanup_and_exit INT
-
# See if the user has a specific pool to restore in mind
restore_pool=$1
dst_pool=${filesystem%%/*}
dst_fs=${filesystem#*/}
# Check to make sure the dst filesystem does not exist
- ssh $remote "$zfs list ${dst_pool}/${dst_fs}" > /dev/null 2>&1
+ if [[ $remote = "localhost" ]]; then
+ $ssh $remote $zfs list ${dst_pool}/${dst_fs} > /dev/null 2>&1
+ else
+ $zfs list ${dst_pool}/${dst_fs} > /dev/null 2>&1
+ fi
if [ $? != 0 ]; then
echo "$filesystem" | grep -q "$restore_pool"
if [ $? == 0 ]; then
# This filesystem matches our restore pool pattern
echo `date` Restoring $filesystem to $remote
- zfs-restore $local_pool $filesystem $dst_pool $dst_fs $remote
+ zfs-restore $backup_pool $filesystem $dst_pool $dst_fs $remote
fi
else
echo "-I- Filesystem already exists on destination. Skipping: $filesystem"