#!/bin/bash
UUID=$(mdata-get sdc:uuid)
DDS=zones/${UUID}/data

if zfs list ${DDS} 1>/dev/null 2>&1; then
	zfs create ${DDS}/www   || true
	zfs create ${DDS}/mysql || true

	zfs set mountpoint=/var/www ${DDS}/www
	zfs set mountpoint=/var/mysql ${DDS}/mysql
fi

# create trash folder for removed virtual hosts
mkdir -p /var/www/.Trash

# znapzend for backup
znapzendzetup create --recursive --tsformat='%Y-%m-%d-%H%M%S' --donotask \
	SRC '7day=>8hour,30day=>1day,1year=>1week,10year=>1month' ${DDS}/www
znapzendzetup create --recursive --tsformat='%Y-%m-%d-%H%M%S' --donotask \
	SRC '7day=>8hour,30day=>1day,1year=>1week,10year=>1month' ${DDS}/mysql
/usr/sbin/svcadm enable svc:/pkgsrc/znapzend:default

#!/bin/bash
UUID=$(mdata-get sdc:uuid)
DDS=zones/${UUID}/data

if zfs list ${DDS} 1>/dev/null 2>&1; then
	zfs create ${DDS}/www   || true
	zfs create ${DDS}/mysql || true

	if ! zfs get -o value -H mountpoint ${DDS}/www | grep -q /var/www; then
		zfs set mountpoint=/var/www ${DDS}/www
	fi
	if ! zfs get -o value -H mountpoint ${DDS}/mysql | grep -q /var/mysql; then
		zfs set mountpoint=/var/mysql ${DDS}/mysql
	fi

	# znapzend for backup
	znapzendzetup create --recursive --tsformat='%Y-%m-%d-%H%M%S' --donotask \
		SRC '2day=>8hour,14day=>1day,1year=>1month,10year=>1year' ${DDS}/www
	znapzendzetup create --recursive --tsformat='%Y-%m-%d-%H%M%S' --donotask \
		SRC '2day=>8hour,14day=>1day,1year=>1month,10year=>1year' ${DDS}/mysql

	/usr/sbin/svcadm enable svc:/pkgsrc/znapzend:default
fi

# create trash folder for removed virtual hosts
mkdir -p /var/www/.Trash

Improve delegate dataset mount option and snapshots
Improve delegate dataset mount option and snapshots

- verify if zfs mountpoint is already configured
- switch snapshot config to 2day=>8hour,14day=>1day,1year=>1month,10year=>1year
- use znapzend only if delegate dataset is used
