mirror of
https://asciireactor.com/o4data/zfs-backup.git
synced 2024-11-21 23:15:05 +00:00
Fixed ordering of operations.
This commit is contained in:
parent
b5013414cb
commit
923fca5795
54
backup.sh
54
backup.sh
@ -33,30 +33,6 @@ MIRROR_PERMS="compression,receive,create,mount,mountpoint,readonly,jailed"
|
||||
|
||||
SEND_DATASETS=""
|
||||
SNAPSHOT_DATASETS=""
|
||||
while read dataset dataset_options; do
|
||||
case $dataset in
|
||||
\#*) continue;;
|
||||
esac
|
||||
|
||||
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="" ;;
|
||||
"remotezfs="*) remotezfs=`echo $option|cut -d'=' -f2` ;
|
||||
dataset="$dataset:$remotezfs" ;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ $send_dataset ]; then
|
||||
SEND_DATASETS="$SEND_DATASETS $dataset"
|
||||
fi
|
||||
if [ $snapshot_dataset ]; then
|
||||
SNAPSHOT_DATASETS="$SNAPSHOT_DATASETS $dataset"
|
||||
fi
|
||||
done < datasets.txt
|
||||
|
||||
debug()
|
||||
{
|
||||
@ -65,6 +41,34 @@ debug()
|
||||
fi
|
||||
}
|
||||
|
||||
populate_datasets()
|
||||
{
|
||||
while read dataset dataset_options; do
|
||||
case $dataset in
|
||||
\#*) continue;;
|
||||
esac
|
||||
|
||||
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="" ;;
|
||||
"remotezfs="*) remotezfs=`echo $option|cut -d'=' -f2` ;
|
||||
dataset="$dataset:$remotezfs" ;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ $send_dataset ]; then
|
||||
SEND_DATASETS="$SEND_DATASETS $dataset"
|
||||
fi
|
||||
if [ $snapshot_dataset ]; then
|
||||
SNAPSHOT_DATASETS="$SNAPSHOT_DATASETS $dataset"
|
||||
fi
|
||||
done < datasets.txt
|
||||
}
|
||||
|
||||
list_datasets()
|
||||
{
|
||||
for dataset in $SEND_DATASETS; do
|
||||
@ -258,6 +262,8 @@ done
|
||||
|
||||
tail -n +2 $nodes_file|grep -v '^#' > sendnodes.tmp
|
||||
|
||||
populate_datasets
|
||||
|
||||
### Command
|
||||
case "$1" in
|
||||
list) list_datasets ;;
|
||||
|
Loading…
Reference in New Issue
Block a user