mirror of
https://asciireactor.com/o4data/zfs-backup.git
synced 2024-11-24 04:25:05 +00:00
Renamed env vars.
This commit is contained in:
parent
ab3edb1d51
commit
5ede78973a
20
backup.sh
20
backup.sh
@ -34,7 +34,7 @@ SNAPSHOT_DATASETS=""
|
||||
|
||||
debug()
|
||||
{
|
||||
if [ "$BG_DEBUG_MODE" = "TRUE" ]; then
|
||||
if [ "$ZB_DEBUG_MODE" = "TRUE" ]; then
|
||||
echo $@
|
||||
fi
|
||||
}
|
||||
@ -103,7 +103,7 @@ list_remote_datasets() {
|
||||
dataset=`echo \\$dataset|cut -d: -f2`
|
||||
zfs list -H $zroot\$dataset;
|
||||
done'"
|
||||
if [ $BG_TEST_MODE = "TRUE" ]; then
|
||||
if [ $ZB_TEST_MODE = "TRUE" ]; then
|
||||
echo ssh $SSH_SEND_OPTS -o port=$ssh_port $user@$addr $run_cmd
|
||||
else
|
||||
ssh $SSH_SEND_OPTS -o port=$ssh_port $user@$addr $run_cmd
|
||||
@ -133,7 +133,7 @@ zfs_allow_origin()
|
||||
{
|
||||
for dataset in $SEND_DATASETS; do
|
||||
dataset=`echo $dataset|cut -d: -f1`
|
||||
if [ $BG_TEST_MODE = "TRUE" ]; then
|
||||
if [ $ZB_TEST_MODE = "TRUE" ]; then
|
||||
echo zfs allow -u $LOCAL_USER $ORIGIN_PERMS $dataset
|
||||
else
|
||||
zfs allow -u $LOCAL_USER $ORIGIN_PERMS $dataset
|
||||
@ -157,7 +157,7 @@ zfs_allow_mirrors()
|
||||
zfs allow -u $user $MIRROR_PERMS $zroot\$dataset
|
||||
done
|
||||
"
|
||||
if [ $BG_TEST_MODE = "TRUE" ]; then
|
||||
if [ $ZB_TEST_MODE = "TRUE" ]; then
|
||||
echo ssh $SSH_SEND_OPTS -o port=$ssh_port $user@$addr $run_cmd
|
||||
|
||||
else
|
||||
@ -170,7 +170,7 @@ create_snapshots()
|
||||
{
|
||||
snapshot_id="`date -I`-`date +%s`-$LOCAL_TZ"
|
||||
for dataset in $SNAPSHOT_DATASETS; do
|
||||
if [ $BG_TEST_MODE = "TRUE" ]; then
|
||||
if [ $ZB_TEST_MODE = "TRUE" ]; then
|
||||
echo zfs snapshot $ZFS_SNAPSHOT_OPTS $dataset@$snapshot_id
|
||||
else
|
||||
zfs snapshot $ZFS_SNAPSHOT_OPTS $dataset@$snapshot_id
|
||||
@ -200,7 +200,7 @@ send_latest()
|
||||
$user@$addr \
|
||||
zfs recv $ZFS_RECV_OPTS $zroot$remote_dataset
|
||||
"
|
||||
if [ $BG_TEST_MODE = "TRUE" ]; then
|
||||
if [ $ZB_TEST_MODE = "TRUE" ]; then
|
||||
echo $run_cmd
|
||||
else
|
||||
$run_cmd
|
||||
@ -232,7 +232,7 @@ send_increment()
|
||||
ssh $SSH_SEND_OPTS -o port=$ssh_port $user@$addr \
|
||||
zfs recv $ZFS_RECV_OPTS $zroot$remote_dataset
|
||||
"
|
||||
if [ $BG_TEST_MODE = "TRUE" ]; then
|
||||
if [ $ZB_TEST_MODE = "TRUE" ]; then
|
||||
echo $run_cmd
|
||||
else
|
||||
$run_cmd
|
||||
@ -249,15 +249,15 @@ set -- `getopt "tdl:" "$@"` || {
|
||||
echo "Usage: `basename $0` [-tdl] [command]" 1>&2
|
||||
exit 1
|
||||
}
|
||||
BG_TEST_MODE=FALSE
|
||||
ZB_TEST_MODE=FALSE
|
||||
while :; do
|
||||
case "$1" in
|
||||
-t)
|
||||
BG_TEST_MODE=TRUE
|
||||
ZB_TEST_MODE=TRUE
|
||||
echo Test mode.
|
||||
;;
|
||||
-d)
|
||||
BG_DEBUG_MODE=TRUE
|
||||
ZB_DEBUG_MODE=TRUE
|
||||
ZFS_SEND_OPTS="$ZFS_SEND_OPTS -v"
|
||||
# Current on by default.
|
||||
# ZFS_RECV_OPTS="$ZFS_RECV_OPTS -v"
|
||||
|
Loading…
Reference in New Issue
Block a user