Added debug function.

This commit is contained in:
Otho 2023-01-16 19:44:22 -05:00
parent f4f86d7783
commit b5013414cb
Signed by: Otho
GPG Key ID: 16C720CD3BBE21D9

View File

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