mirror of
https://asciireactor.com/o4data/zfs-backup.git
synced 2024-11-25 04:15:07 +00:00
Added debug function.
This commit is contained in:
parent
f4f86d7783
commit
b5013414cb
14
backup.sh
14
backup.sh
@ -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 \| \
|
||||||
|
Loading…
Reference in New Issue
Block a user