Changeset aac00e0


Ignore:
Timestamp:
08/22/13 12:45:04 (14 months ago)
Author:
Kris Moore <kris@…>
Branches:
master, 9.2-release, releng/10.0, releng/10.0.1, releng/10.0.2, releng/10.0.3
Children:
69265de
Parents:
197bdbf
Message:

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

Location:
src-sh/lpreserver
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • src-sh/lpreserver/backend/functions.sh

    rcb8f638 raac00e0  
    245245  export REPRDATA=`echo $repLine | cut -d ':' -f 6` 
    246246 
     247  if [ "$2" = "force" ] ; then 
     248     # Ready to do a forced replication 
     249     export DIDREP=1 
     250     echo_log "Starting replication MANUAL task on ${DATASET}: ${REPLOGSEND}" 
     251     queue_msg "`date`: Starting replication MANUAL task on ${DATASET}\n" 
     252     start_rep_task "$LDATA" 
     253     return $? 
     254  fi 
     255 
    247256  # If we are checking for a sync task, and the rep isn't marked as sync we can return 
    248257  if [ "$2" = "sync" -a "$TIME" != "sync" ] ; then return 0; fi 
  • src-sh/lpreserver/backend/runrep.sh

    rac48c86 raac00e0  
    2323if [ $DIDREP -eq 0 ] ; then exit 0 ; fi 
    2424 
     25if [ "$TIME" = "force" ] ; then 
     26  type="Manual"  
     27else 
     28  type="Automated"  
     29fi 
     30 
    2531if [ $status -eq 0 ] ; then 
    2632  title="Success" 
     
    3036 
    3137case $EMAILMODE in 
    32     ALL) email_msg "$title - Automated Replication" "`echo_queue_msg`" ;; 
     38    ALL) email_msg "$title - $type Replication" "`echo_queue_msg`" ;; 
    3339    *) if [ $status -ne 0 ] ; then 
    34           email_msg "$title - Automated Replication" "`echo_queue_msg`" 
     40          email_msg "$title - $type Replication" "`echo_queue_msg`" 
    3541       fi 
    3642       ;; 
  • src-sh/lpreserver/backend/zfsmksnap.sh

    rc684936 raac00e0  
    1818fi 
    1919 
    20 mkZFSSnap "${DATASET}" "" 
     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 
  • src-sh/lpreserver/lpreserver

    r5cc3d00 raac00e0  
    293293 echo "Help mksnap 
    294294 
    295 Create a new ZFS snapshot of a dataset 
    296  
    297 Usage: 
    298  
    299   lupdate mksnap <dataset> 
    300  
    301 Example: 
    302  
    303   lupdate mksnap tank1/usr/home/kris 
     295Create a new ZFS snapshot of a dataset and optionally replicate it immediately 
     296 
     297Usage: 
     298 
     299  lpreserver mksnap --replicate <dataset> <snapshotname> 
     300 
     301Example: 
     302 
     303  lpreserver mksnap tank1/usr/home/kris mysnapshot 
     304 
     305  or 
     306 
     307  lpreserver mksnap --replicate tank1/usr/home/kris mysnapshot 
    304308 
    305309NOTE: 
     
    369373 
    370374   mksnap) require_root 
    371          DATASET="$2" 
    372          ${PROGDIR}/backend/zfsmksnap.sh "${DATASET}" 
     375         if [ "$2" = "--replicate" ] ; then 
     376           REP="YES" 
     377           DATASET="$3" 
     378           SNAPNAME="$4" 
     379         else 
     380           REP="NO" 
     381           DATASET="$2" 
     382           SNAPNAME="$3" 
     383         fi 
     384         ${PROGDIR}/backend/zfsmksnap.sh "${DATASET}" "$SNAPNAME" "$REP" 
    373385         ;; 
    374386 
Note: See TracChangeset for help on using the changeset viewer.