-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: fix sanoid_post_remove_vzdump.sh
- Loading branch information
Showing
2 changed files
with
12 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,17 @@ | ||
#!/usr/bin/env bash | ||
|
||
# SANOID_TARGETS is an env variable set by sanoid before calling this script | ||
|
||
# This script removes eventual vzdump snapshots that where synchronized | ||
# but shan't have been | ||
# This is for backup of datasets only (not local one) | ||
readarray -d "," DATASETS <<< $SANOID_TARGETS | ||
for DATASET in "${DATASETS[@]}" | ||
do | ||
if ( zfs list "$DATASET"@vzdump ) | ||
# remove line returns | ||
DATASET=$(echo $DATASET|tr -d '\r\n') | ||
if [[ -n "$DATASET" ]] && ( zfs list "$DATASET@vzdump" ) | ||
then | ||
zfs destroy "$DATASET"@vzdump | ||
zfs destroy "$DATASET@vzdump" | ||
fi | ||
done |