source: src-sh/lpreserver/backend/zfslistcron.sh @ 9cd0fa0

releng/10.0.1releng/10.0.2
Last change on this file since 9cd0fa0 was 9cd0fa0, checked in by Kris Moore <kris@…>, 6 months ago
  • Major update to life-preserver backend

Add new "automatic" mode for creating snapshots

When enabled, this will create snapshots in the following manner:

  • Snapshots will be created every 5 minutes and kept for an hour.
  • A hourly snapshot will be kept for a day.
  • A daily snapshot will be kept for a month.
  • A Monthly snapshot will be kept for a year.
  • The life-preserver daemon will also keep track of the zpool disk space, if the capacity falls below 75%, the oldest snapshot will be auto-pruned.
  • Property mode set to 100755
File size: 1.1 KB
Line 
1#!/bin/sh
2# ZFS functionality
3# Args $1 = jail-name
4# Args $2 = zfs directive
5#######################################################################
6
7# Source our functions
8PROGDIR="/usr/local/share/lpreserver"
9
10# Source our variables
11. /usr/local/share/pcbsd/scripts/functions.sh
12. ${PROGDIR}/backend/functions.sh
13
14echo "Datasets scheduled for snapshots:"
15echo "---------------------------------"
16for i in `grep "${PROGDIR}/backend/runsnap.sh" /etc/crontab | awk '{print $8}'`
17do
18   min=`grep "${PROGDIR}/backend/runsnap.sh ${i}" /etc/crontab | awk '{print $1}'`
19   hour=`grep "${PROGDIR}/backend/runsnap.sh ${i}" /etc/crontab | awk '{print $2}'`
20   count=`grep "${PROGDIR}/backend/runsnap.sh ${i}" /etc/crontab | awk '{print $9}'`
21   time="Min: $min Hour: $hour";
22   if [ "$min" = "0" -a "$hour" != '*' ] ; then time="daily@$hour" ; fi
23   if [ "$min" = "0" -a "$hour" = '*' ] ; then time="hourly" ; fi
24   if [ "$min" = "0,30" ] ; then time="30min" ; fi
25   if [ "$min" = '*/10' ] ; then time="10min" ; fi
26   if [ "$min" = '*/5' ] ; then time="5min" ; fi
27   if [ "$min" = '*/5' -a "$count" = "auto" ] ; then time="Automatic" ; fi
28   echo "$i - $time - total: $count"
29done
Note: See TracBrowser for help on using the repository browser.