diff --git a/backup.sh b/backup.sh index 39d671a..5ded6e6 100755 --- a/backup.sh +++ b/backup.sh @@ -41,6 +41,7 @@ while read dataset dataset_options; do snapshot_dataset="yes" send_dataset="yes" for option in $dataset_options; do + debug "Processing option $option." case $option in "nosnap"* ) snapshot_dataset="" ;; "nosend"* ) send_dataset="" ;; @@ -57,6 +58,13 @@ while read dataset dataset_options; do fi done < datasets.txt +debug() +{ + if [ $BG_DEBUG_MODE = "TRUE" ]; do + echo $@ + fi +} + list_datasets() { for dataset in $SEND_DATASETS; do @@ -171,10 +179,8 @@ send_latest() for dataset in $SEND_DATASETS; do dataset=`echo $dataset|cut -d':' -f1` remote_dataset=`echo $dataset|cut -d':' -f2` - if [ $BG_DEBUG_MODE = "TRUE" ]; then - echo dataset: $dataset - echo remote dataset: $remote_dataset - fi + debug "dataset: $dataset" + debug "remote dataset: $remote_dataset" origin_snapshot=`get_latest_snapshot $dataset` if [ $BG_TEST_MODE = "TRUE" ]; then echo zfs send $ZFS_SEND_OPTS $dataset@$origin_snapshot \| \