source: src-sh/lpreserver/backend/zfsmksnap.sh @ aac00e0

9.2-releasereleng/10.0releng/10.0.1releng/10.0.2
Last change on this file since aac00e0 was aac00e0, checked in by Kris Moore <kris@…>, 11 months ago

Add --replicate option to "mksnap" to force immediate replication

  • Property mode set to 100755
File size: 1.4 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
14DATASET="${1}"
15
16if [ -z "${DATASET}" ]; then
17  exit_err "No dataset specified!"
18fi
19
20SNAPNAME="${2}"
21if [ -z "${SNAPNAME}" ]; then
22  exit_err "No snapshot name specified!"
23fi
24
25REPLICATE="${3}"
26
27# Make the snapshot now
28snapStat=0
29
30echo_log "Creating snapshot on ${DATASET}"
31mkZFSSnap "${DATASET}" "${SNAPNAME}"
32if [ $? -ne 0 ] ; then
33  echo_log "ERROR: Failed creating snapshot on ${DATASET}"
34  queue_msg "Snapshot ERROR" "ERROR: Failed creating snapshot on ${DATASET} @ `date`\n\r`cat $CMDLOG`"
35  snapStat=1
36else
37  queue_msg "Success creating snapshot on ${DATASET} @ `date`\n\r`cat $CMDLOG`"
38fi
39
40# If we failed at any point, sent out a notice
41if [ $snapStat -ne 0 ] ; then
42   email_msg "FAILED - Manual Snapshot" "`echo_queue_msg`"
43fi
44
45# If we are successful and user wants all notifications, send out a message
46if [ $snapStat -eq 0 -a "$EMAILMODE" = "ALL" ] ; then
47   email_msg "Success - Manual Snapshot" "`echo_queue_msg`"
48fi
49
50
51
52# Check if we need to run a replication task for this dataset
53if [ "$REPLICATE" = "YES" ] ; then
54  ${PROGDIR}/backend/runrep.sh ${DATASET} force
55fi
Note: See TracBrowser for help on using the repository browser.