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"
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 \| \