forked from extern/zfs-auto-snapshot
Reorder manifests so :default gets added first, clean up instance manifests, remove old sample instances
check_missed_snapshots should not use print_log
This commit is contained in:
parent
963195f258
commit
58733e075b
@ -384,8 +384,8 @@ function check_missed_snapshots { # $INTERVAL $PERIOD $FMRI <repopulate cache>
|
||||
PERIOD_S=$(( $MULTIPLIER * $PERIOD ))
|
||||
AGO=$(( $NOW - $LAST_SNAP_TIME ))
|
||||
if [ $AGO -gt $PERIOD_S ] ; then
|
||||
print_log "Last snapshot for $FMRI taken on $LAST_SNAP_TIME_HUMAN"
|
||||
print_log "which was greater than the $PERIOD $INTERVAL schedule. Taking snapshot now."
|
||||
echo "Last snapshot for $FMRI taken on $LAST_SNAP_TIME_HUMAN"
|
||||
echo "which was greater than the $PERIOD $INTERVAL schedule. Taking snapshot now."
|
||||
take_snapshot $FMRI $NO_CACHE_REPOPULATE
|
||||
fi
|
||||
}
|
||||
|
@ -13,9 +13,13 @@ d none var/svc 0755 root sys
|
||||
d none var/svc/manifest 0755 root sys
|
||||
d none var/svc/manifest/system 0755 root sys
|
||||
d none var/svc/manifest/system/filesystem 0755 root sys
|
||||
f manifest var/svc/manifest/system/filesystem/zfs-auto-snapshot.xml 0644 root sys
|
||||
f manifest var/svc/manifest/system/filesystem/auto-snapshot-monthly.xml 0644 root sys
|
||||
f manifest var/svc/manifest/system/filesystem/auto-snapshot-frequent.xml 0644 root sys
|
||||
f manifest var/svc/manifest/system/filesystem/auto-snapshot-daily.xml 0644 root sys
|
||||
f manifest var/svc/manifest/system/filesystem/auto-snapshot-hourly.xml 0644 root sys
|
||||
f manifest var/svc/manifest/system/filesystem/auto-snapshot-weekly.xml 0644 root sys
|
||||
# The order here is important: the auto-snapshot.xml manifest
|
||||
# must be imported before the instance manifests, otherwise
|
||||
# dependency information isn't set in the instances until
|
||||
# they get refreshed.
|
||||
f manifest var/svc/manifest/system/filesystem/auto-snapshot.xml 0644 root sys
|
||||
f manifest var/svc/manifest/system/filesystem/zfs-auto-snapshot-monthly.xml 0644 root sys
|
||||
f manifest var/svc/manifest/system/filesystem/zfs-auto-snapshot-frequent.xml 0644 root sys
|
||||
f manifest var/svc/manifest/system/filesystem/zfs-auto-snapshot-daily.xml 0644 root sys
|
||||
f manifest var/svc/manifest/system/filesystem/zfs-auto-snapshot-hourly.xml 0644 root sys
|
||||
f manifest var/svc/manifest/system/filesystem/zfs-auto-snapshot-weekly.xml 0644 root sys
|
||||
|
@ -12,18 +12,6 @@
|
||||
|
||||
<instance name='space-archive' enabled='false' >
|
||||
|
||||
<exec_method
|
||||
type='method'
|
||||
name='start'
|
||||
exec='/lib/svc/method/zfs-auto-snapshot start'
|
||||
timeout_seconds='0' />
|
||||
|
||||
<exec_method
|
||||
type='method'
|
||||
name='stop'
|
||||
exec='/lib/svc/method/zfs-auto-snapshot stop'
|
||||
timeout_seconds='0' />
|
||||
|
||||
<property_group name='startd' type='framework'>
|
||||
<propval name='duration' type='astring' value='transient' />
|
||||
</property_group>
|
||||
|
@ -14,18 +14,6 @@
|
||||
|
||||
<instance name='space-timf,backup' enabled='false' >
|
||||
|
||||
<exec_method
|
||||
type='method'
|
||||
name='start'
|
||||
exec='/lib/svc/method/zfs-auto-snapshot start'
|
||||
timeout_seconds='0' />
|
||||
|
||||
<exec_method
|
||||
type='method'
|
||||
name='stop'
|
||||
exec='/lib/svc/method/zfs-auto-snapshot stop'
|
||||
timeout_seconds='0' />
|
||||
|
||||
<property_group name='startd' type='framework'>
|
||||
<propval name='duration' type='astring' value='transient' />
|
||||
</property_group>
|
||||
|
@ -1,68 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
|
||||
<service_bundle type='manifest' name='space-timf,daily'>
|
||||
|
||||
<!-- A service instance to take daily snapshots of space/timf. It keeps 7 days
|
||||
worth of snapshots into the past, before deleting them -->
|
||||
|
||||
<service
|
||||
name='system/filesystem/zfs/auto-snapshot'
|
||||
type='service'
|
||||
version='0.11'>
|
||||
<create_default_instance enabled='false' />
|
||||
|
||||
<instance name='space-timf,daily' enabled='false' >
|
||||
|
||||
<exec_method
|
||||
type='method'
|
||||
name='start'
|
||||
exec='/lib/svc/method/zfs-auto-snapshot start'
|
||||
timeout_seconds='0' />
|
||||
|
||||
<exec_method
|
||||
type='method'
|
||||
name='stop'
|
||||
exec='/lib/svc/method/zfs-auto-snapshot stop'
|
||||
timeout_seconds='0' />
|
||||
|
||||
<property_group name='startd' type='framework'>
|
||||
<propval name='duration' type='astring' value='transient' />
|
||||
</property_group>
|
||||
|
||||
<!-- properties for zfs automatic snapshots -->
|
||||
<property_group name="zfs" type="application">
|
||||
|
||||
<propval name="fs-name" type="astring" value="space/timf"
|
||||
override="true"/>
|
||||
<propval name="interval" type="astring" value="days"
|
||||
override="true"/>
|
||||
<propval name="period" type="astring" value="1"
|
||||
override="true"/>
|
||||
<propval name="offset" type="astring" value="0"
|
||||
override="true"/>
|
||||
<propval name="keep" type="astring" value="7"
|
||||
override="true"/>
|
||||
<propval name="snapshot-children" type="boolean" value="true"
|
||||
override="true"/>
|
||||
|
||||
<propval name="backup" type="astring" value="none"
|
||||
override="true"/>
|
||||
<propval name="backup-save-cmd" type="astring" value="eval cat > /extra/`echo $LAST_SNAP | sed -e 's#/#-#g'`"
|
||||
override="true"/>
|
||||
<propval name="backup-lock" type="astring" value="unlocked"
|
||||
override="true"/>
|
||||
|
||||
<propval name="label" type="astring" value="daily"
|
||||
override="true"/>
|
||||
<propval name="verbose" type="boolean" value="false"
|
||||
override="true"/>
|
||||
<propval name="avoidscrub" type="boolean" value="true"
|
||||
override="true"/>
|
||||
|
||||
</property_group>
|
||||
|
||||
</instance>
|
||||
|
||||
<stability value='Unstable' />
|
||||
</service>
|
||||
</service_bundle>
|
@ -1,68 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
|
||||
<service_bundle type='manifest' name='space-timf,frequent'>
|
||||
|
||||
<!-- A service instance that takes snapshots every 10 minutes, keeping 60 snapshots
|
||||
into the past. All child filesystems of space/timf are also snapshotted. -->
|
||||
|
||||
<service
|
||||
name='system/filesystem/zfs/auto-snapshot'
|
||||
type='service'
|
||||
version='0.11'>
|
||||
<create_default_instance enabled='false' />
|
||||
|
||||
<instance name='space-timf,frequent' enabled='false' >
|
||||
|
||||
<exec_method
|
||||
type='method'
|
||||
name='start'
|
||||
exec='/lib/svc/method/zfs-auto-snapshot start'
|
||||
timeout_seconds='0' />
|
||||
|
||||
<exec_method
|
||||
type='method'
|
||||
name='stop'
|
||||
exec='/lib/svc/method/zfs-auto-snapshot stop'
|
||||
timeout_seconds='0' />
|
||||
|
||||
<property_group name='startd' type='framework'>
|
||||
<propval name='duration' type='astring' value='transient' />
|
||||
</property_group>
|
||||
|
||||
<!-- properties for zfs automatic snapshots -->
|
||||
<property_group name="zfs" type="application">
|
||||
|
||||
<propval name="fs-name" type="astring" value="space/timf"
|
||||
override="true"/>
|
||||
<propval name="interval" type="astring" value="minutes"
|
||||
override="true"/>
|
||||
<propval name="period" type="astring" value="10"
|
||||
override="true"/>
|
||||
<propval name="offset" type="astring" value="0"
|
||||
override="true"/>
|
||||
<propval name="keep" type="astring" value="60"
|
||||
override="true"/>
|
||||
<propval name="snapshot-children" type="boolean" value="true"
|
||||
override="true"/>
|
||||
|
||||
<propval name="backup" type="astring" value="none"
|
||||
override="true"/>
|
||||
<propval name="backup-save-cmd" type="astring" value=""
|
||||
override="true"/>
|
||||
<propval name="backup-lock" type="astring" value="unlocked"
|
||||
override="true"/>
|
||||
|
||||
<propval name="label" type="astring" value="frequent"
|
||||
override="true"/>
|
||||
<propval name="verbose" type="boolean" value="false"
|
||||
override="true"/>
|
||||
<propval name="avoidscrub" type="boolean" value="true"
|
||||
override="true"/>
|
||||
|
||||
</property_group>
|
||||
|
||||
</instance>
|
||||
|
||||
<stability value='Unstable' />
|
||||
</service>
|
||||
</service_bundle>
|
@ -1,68 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
|
||||
<service_bundle type='manifest' name='space-timf,monthly'>
|
||||
|
||||
<!-- A service instance to take monthly snapshots of space/timf. Child filesystems
|
||||
are also snapshotted, and backups are taken into the /extra filesystem. -->
|
||||
|
||||
<service
|
||||
name='system/filesystem/zfs/auto-snapshot'
|
||||
type='service'
|
||||
version='0.11'>
|
||||
<create_default_instance enabled='false' />
|
||||
|
||||
<instance name='space-timf,monthly' enabled='false' >
|
||||
|
||||
<exec_method
|
||||
type='method'
|
||||
name='start'
|
||||
exec='/lib/svc/method/zfs-auto-snapshot start'
|
||||
timeout_seconds='10' />
|
||||
|
||||
<exec_method
|
||||
type='method'
|
||||
name='stop'
|
||||
exec='/lib/svc/method/zfs-auto-snapshot stop'
|
||||
timeout_seconds='10' />
|
||||
|
||||
<property_group name='startd' type='framework'>
|
||||
<propval name='duration' type='astring' value='transient' />
|
||||
</property_group>
|
||||
|
||||
<!-- properties for zfs automatic snapshots -->
|
||||
<property_group name="zfs" type="application">
|
||||
|
||||
<propval name="fs-name" type="astring" value="space/timf"
|
||||
override="true"/>
|
||||
<propval name="interval" type="astring" value="months"
|
||||
override="true"/>
|
||||
<propval name="period" type="astring" value="1"
|
||||
override="true"/>
|
||||
<propval name="offset" type="astring" value="0"
|
||||
override="true"/>
|
||||
<propval name="keep" type="astring" value="3"
|
||||
override="true"/>
|
||||
<propval name="snapshot-children" type="boolean" value="true"
|
||||
override="true"/>
|
||||
|
||||
<propval name="backup" type="astring" value="full"
|
||||
override="true"/>
|
||||
<propval name="backup-save-cmd" type="astring" value="eval cat > /extra/`echo $LAST_SNAP | sed -e 's#/#-#g'`"
|
||||
override="true"/>
|
||||
<propval name="backup-lock" type="astring" value="unlocked"
|
||||
override="true"/>
|
||||
|
||||
<propval name="label" type="astring" value="monthly"
|
||||
override="true"/>
|
||||
<propval name="verbose" type="boolean" value="false"
|
||||
override="true"/>
|
||||
<propval name="avoidscrub" type="boolean" value="true"
|
||||
override="true"/>
|
||||
|
||||
</property_group>
|
||||
|
||||
</instance>
|
||||
|
||||
<stability value='Unstable' />
|
||||
</service>
|
||||
</service_bundle>
|
@ -1,68 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
|
||||
<service_bundle type='manifest' name='tank-rootfs'>
|
||||
|
||||
<!-- A service instance that takes snapshots every 5 days of my mountroot
|
||||
filesystem -->
|
||||
|
||||
<service
|
||||
name='system/filesystem/zfs/auto-snapshot'
|
||||
type='service'
|
||||
version='0.11'>
|
||||
<create_default_instance enabled='false' />
|
||||
|
||||
<instance name='tank-rootfs' enabled='false' >
|
||||
|
||||
<exec_method
|
||||
type='method'
|
||||
name='start'
|
||||
exec='/lib/svc/method/zfs-auto-snapshot start'
|
||||
timeout_seconds='0' />
|
||||
|
||||
<exec_method
|
||||
type='method'
|
||||
name='stop'
|
||||
exec='/lib/svc/method/zfs-auto-snapshot stop'
|
||||
timeout_seconds='0' />
|
||||
|
||||
<property_group name='startd' type='framework'>
|
||||
<propval name='duration' type='astring' value='transient' />
|
||||
</property_group>
|
||||
|
||||
<!-- properties for zfs automatic snapshots -->
|
||||
<property_group name="zfs" type="application">
|
||||
|
||||
<propval name="fs-name" type="astring" value="tank/rootfs"
|
||||
override="true"/>
|
||||
<propval name="interval" type="astring" value="days"
|
||||
override="true"/>
|
||||
<propval name="period" type="astring" value="5"
|
||||
override="true"/>
|
||||
<propval name="offset" type="astring" value="0"
|
||||
override="true"/>
|
||||
<propval name="keep" type="astring" value="3"
|
||||
override="true"/>
|
||||
<propval name="snapshot-children" type="boolean" value="false"
|
||||
override="true"/>
|
||||
|
||||
<propval name="backup" type="astring" value="none"
|
||||
override="true"/>
|
||||
<propval name="backup-save-cmd" type="astring" value=""
|
||||
override="true"/>
|
||||
<propval name="backup-lock" type="astring" value="unlocked"
|
||||
override="true"/>
|
||||
|
||||
<propval name="label" type="astring" value=""
|
||||
override="true"/>
|
||||
<propval name="verbose" type="boolean" value="false"
|
||||
override="true"/>
|
||||
<propval name="avoidscrub" type="boolean" value="true"
|
||||
override="true"/>
|
||||
|
||||
</property_group>
|
||||
|
||||
</instance>
|
||||
|
||||
<stability value='Unstable' />
|
||||
</service>
|
||||
</service_bundle>
|
46
src/var/svc/manifest/system/filesystem/zfs-auto-snapshot.xml → src/var/svc/manifest/system/filesystem/auto-snapshot.xml
Executable file → Normal file
46
src/var/svc/manifest/system/filesystem/zfs-auto-snapshot.xml → src/var/svc/manifest/system/filesystem/auto-snapshot.xml
Executable file → Normal file
@ -27,7 +27,7 @@
|
||||
|
||||
-->
|
||||
|
||||
<service_bundle type='manifest' name='SUNWzfs-auto-snapshot:filesystem-zfs-auto-snapshot'>
|
||||
<service_bundle type='manifest' name='SUNWzfs-auto-snapshot:filesystem-auto-snapshot'>
|
||||
|
||||
<service
|
||||
name='system/filesystem/zfs/auto-snapshot'
|
||||
@ -53,6 +53,26 @@
|
||||
<service_fmri value="svc:/system/cron" />
|
||||
</dependency>
|
||||
|
||||
<exec_method
|
||||
type='method'
|
||||
name='start'
|
||||
exec='/lib/svc/method/zfs-auto-snapshot start'
|
||||
timeout_seconds='0'>
|
||||
<method_context>
|
||||
<method_credential user='zfssnap' group='daemon' />
|
||||
</method_context>
|
||||
</exec_method>
|
||||
|
||||
<exec_method
|
||||
type='method'
|
||||
name='stop'
|
||||
exec='/lib/svc/method/zfs-auto-snapshot stop'
|
||||
timeout_seconds='0' >
|
||||
<method_context>
|
||||
<method_credential user='zfssnap' group='daemon' />
|
||||
</method_context>
|
||||
</exec_method>
|
||||
|
||||
<property_group name='startd' type='framework'>
|
||||
<propval name='duration' type='astring' value='transient' />
|
||||
</property_group>
|
||||
@ -174,30 +194,6 @@ they being :
|
||||
sufficiently high numbers of instances, we can trip, say a 10
|
||||
sec. timeout.
|
||||
|
||||
<exec_method
|
||||
type='method'
|
||||
name='start'
|
||||
exec='/lib/svc/method/zfs-auto-snapshot start'
|
||||
timeout_seconds='0'>
|
||||
<method_context>
|
||||
<method_credential user='zfssnap' group='daemon' />
|
||||
</method_context>
|
||||
</exec_method>
|
||||
|
||||
<exec_method
|
||||
type='method'
|
||||
name='stop'
|
||||
exec='/lib/svc/method/zfs-auto-snapshot stop'
|
||||
timeout_seconds='0' >
|
||||
<method_context>
|
||||
<method_credential user='zfssnap' group='daemon' />
|
||||
</method_context>
|
||||
</exec_method>
|
||||
|
||||
<property_group name='startd' type='framework'>
|
||||
<propval name='duration' type='astring' value='transient' />
|
||||
</property_group>
|
||||
|
||||
<property_group name="zfs" type="application">
|
||||
|
||||
<propval name="fs-name" type="astring" value="tank/timf"/>
|
@ -17,30 +17,6 @@ snapshots into the past.
|
||||
|
||||
<instance name='daily' enabled='false' >
|
||||
|
||||
<exec_method
|
||||
type='method'
|
||||
name='start'
|
||||
exec='/lib/svc/method/zfs-auto-snapshot start'
|
||||
timeout_seconds='0'>
|
||||
<method_context>
|
||||
<method_credential user='zfssnap' group='daemon' />
|
||||
</method_context>
|
||||
</exec_method>
|
||||
|
||||
<exec_method
|
||||
type='method'
|
||||
name='stop'
|
||||
exec='/lib/svc/method/zfs-auto-snapshot stop'
|
||||
timeout_seconds='0' >
|
||||
<method_context>
|
||||
<method_credential user='zfssnap' group='daemon' />
|
||||
</method_context>
|
||||
</exec_method>
|
||||
|
||||
<property_group name='startd' type='framework'>
|
||||
<propval name='duration' type='astring' value='transient' />
|
||||
</property_group>
|
||||
|
||||
<!-- properties for zfs automatic snapshots -->
|
||||
<property_group name="zfs" type="application">
|
||||
|
@ -17,30 +17,6 @@ com.sun:auto-snapshot:frequent=true every
|
||||
|
||||
<instance name='frequent' enabled='false' >
|
||||
|
||||
<exec_method
|
||||
type='method'
|
||||
name='start'
|
||||
exec='/lib/svc/method/zfs-auto-snapshot start'
|
||||
timeout_seconds='0'>
|
||||
<method_context>
|
||||
<method_credential user='zfssnap' group='daemon' />
|
||||
</method_context>
|
||||
</exec_method>
|
||||
|
||||
<exec_method
|
||||
type='method'
|
||||
name='stop'
|
||||
exec='/lib/svc/method/zfs-auto-snapshot stop'
|
||||
timeout_seconds='0' >
|
||||
<method_context>
|
||||
<method_credential user='zfssnap' group='daemon' />
|
||||
</method_context>
|
||||
</exec_method>
|
||||
|
||||
<property_group name='startd' type='framework'>
|
||||
<propval name='duration' type='astring' value='transient' />
|
||||
</property_group>
|
||||
|
||||
<!-- properties for zfs automatic snapshots -->
|
||||
<property_group name="zfs" type="application">
|
||||
|
@ -17,30 +17,6 @@ and keeps 24 of these snapshots into the past.
|
||||
|
||||
<instance name='hourly' enabled='false' >
|
||||
|
||||
<exec_method
|
||||
type='method'
|
||||
name='start'
|
||||
exec='/lib/svc/method/zfs-auto-snapshot start'
|
||||
timeout_seconds='0'>
|
||||
<method_context>
|
||||
<method_credential user='zfssnap' group='daemon' />
|
||||
</method_context>
|
||||
</exec_method>
|
||||
|
||||
<exec_method
|
||||
type='method'
|
||||
name='stop'
|
||||
exec='/lib/svc/method/zfs-auto-snapshot stop'
|
||||
timeout_seconds='0' >
|
||||
<method_context>
|
||||
<method_credential user='zfssnap' group='daemon' />
|
||||
</method_context>
|
||||
</exec_method>
|
||||
|
||||
<property_group name='startd' type='framework'>
|
||||
<propval name='duration' type='astring' value='transient' />
|
||||
</property_group>
|
||||
|
||||
<!-- properties for zfs automatic snapshots -->
|
||||
<property_group name="zfs" type="application">
|
||||
|
@ -17,30 +17,6 @@ and keeps 12 of these snapshots into the past.
|
||||
|
||||
<instance name='monthly' enabled='false' >
|
||||
|
||||
<exec_method
|
||||
type='method'
|
||||
name='start'
|
||||
exec='/lib/svc/method/zfs-auto-snapshot start'
|
||||
timeout_seconds='0'>
|
||||
<method_context>
|
||||
<method_credential user='zfssnap' group='daemon' />
|
||||
</method_context>
|
||||
</exec_method>
|
||||
|
||||
<exec_method
|
||||
type='method'
|
||||
name='stop'
|
||||
exec='/lib/svc/method/zfs-auto-snapshot stop'
|
||||
timeout_seconds='0' >
|
||||
<method_context>
|
||||
<method_credential user='zfssnap' group='daemon' />
|
||||
</method_context>
|
||||
</exec_method>
|
||||
|
||||
<property_group name='startd' type='framework'>
|
||||
<propval name='duration' type='astring' value='transient' />
|
||||
</property_group>
|
||||
|
||||
<!-- properties for zfs automatic snapshots -->
|
||||
<property_group name="zfs" type="application">
|
||||
|
@ -17,30 +17,6 @@ and keeps 4 of these snapshots into the past.
|
||||
|
||||
<instance name='weekly' enabled='false' >
|
||||
|
||||
<exec_method
|
||||
type='method'
|
||||
name='start'
|
||||
exec='/lib/svc/method/zfs-auto-snapshot start'
|
||||
timeout_seconds='0'>
|
||||
<method_context>
|
||||
<method_credential user='zfssnap' group='daemon' />
|
||||
</method_context>
|
||||
</exec_method>
|
||||
|
||||
<exec_method
|
||||
type='method'
|
||||
name='stop'
|
||||
exec='/lib/svc/method/zfs-auto-snapshot stop'
|
||||
timeout_seconds='0' >
|
||||
<method_context>
|
||||
<method_credential user='zfssnap' group='daemon' />
|
||||
</method_context>
|
||||
</exec_method>
|
||||
|
||||
<property_group name='startd' type='framework'>
|
||||
<propval name='duration' type='astring' value='transient' />
|
||||
</property_group>
|
||||
|
||||
<!-- properties for zfs automatic snapshots -->
|
||||
<property_group name="zfs" type="application">
|
||||
|
Loading…
Reference in New Issue
Block a user