File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -61,6 +61,7 @@ WARNING_COUNT='0'
6161# Other global variables.
6262SNAPSHOTS_OLD=' '
6363SNAPS_DONE=' '
64+ SNAPS_DESTROY=' '
6465
6566
6667print_usage ()
@@ -288,6 +289,8 @@ $tmp"
288289 if do_run " zfs destroy $FLAGS '$jj '"
289290 then
290291 DESTRUCTION_COUNT=$(( $DESTRUCTION_COUNT + 1 ))
292+ [ -n " $opt_send " ] && SNAPS_DESTROY=" $SNAPS_DESTROY
293+ $jj "
291294 else
292295 WARNING_COUNT=$(( $WARNING_COUNT + 1 ))
293296 fi
@@ -361,6 +364,24 @@ do_send () # snapname, oldglob
361364 done
362365}
363366
367+
368+ do_destroy_remotes ()
369+ {
370+ local FLAGS=" $1 "
371+ local ii
372+ local remote_ssh=" ssh $opt_send_ssh_opts "
373+
374+ # Go through each option to --send-{incr,full}.
375+ # rem=<remote_host>:<remote_pool>
376+ for rem in $opt_send ; do
377+ for ii in $SNAPS_DESTROY
378+ do
379+ do_run " $remote_ssh ${rem%:* } zfs destroy $FLAGS '$ii '"
380+ done
381+ done
382+ }
383+
384+
364385# main ()
365386# {
366387
@@ -774,6 +795,7 @@ do_snapshots "$SNAPPROP" "" "$SNAPNAME" "$SNAPGLOB" "$TARGETS_REGULAR"
774795do_snapshots " $SNAPPROP " " -r" " $SNAPNAME " " $SNAPGLOB " " $TARGETS_RECURSIVE "
775796
776797do_send " $SNAPNAME " " $SNAPGLOB "
798+ do_destroy_remotes
777799
778800print_log notice " @$SNAPNAME ," \
779801 " $SNAPSHOT_COUNT created," \
You can’t perform that action at this time.
0 commit comments