diff --git a/mkdumprd b/mkdumprd index b866a9b..d062a91 100644 --- a/mkdumprd +++ b/mkdumprd @@ -94,7 +94,7 @@ to_mount() { #$1=dump target #called from while loop and shouldn't read from stdin, so we're using "ssh -n" get_ssh_size() { - local _opt _out _size + local _opt _out _opt="-i $SSH_KEY_LOCATION -o BatchMode=yes -o StrictHostKeyChecking=yes" _out=$(ssh -q -n $_opt $1 "df -P $SAVE_PATH") [ $? -ne 0 ] && { @@ -102,8 +102,7 @@ get_ssh_size() { } #ssh output removed the line break, so print field NF-2 - _size=$(echo -n $_out| awk '{avail=NF-2; print $avail}') - echo -n $_size + echo -n "$_out" | awk '{avail=NF-2; print $avail}' } #mkdir if save path does not exist on ssh dump target @@ -134,14 +133,13 @@ mkdir_save_path_ssh() #Function: get_fs_size #$1=dump target get_fs_size() { - local _mnt=$(get_mntpoint_from_target $1) - echo -n $(df -P "${_mnt}/$SAVE_PATH"|tail -1|awk '{print $4}') + df -P "$(get_mntpoint_from_target "$1")/$SAVE_PATH"|tail -1|awk '{print $4}' } #Function: get_raw_size #$1=dump target get_raw_size() { - echo -n $(fdisk -s "$1") + fdisk -s "$1" } #Function: check_size