ssh_str=("$CMD_SSH" "-2" "-4")
scp_str=("${CMD_SCP}" "-2" "-4" "-B ${SSH_OPTS}")
-
+
if [ -n "${SSHport}" ]; then
ssh_str+=("-p ${SSHport}")
scp_str+=("-P ${SSHport}")
ssh_str+=("-p ${DEFAULT_SSH_PORT}")
scp_str+=("-P ${DEFAULT_SSH_PORT}")
fi
-
+
if [ -n "${SSHuser}" ]; then
ssh_str+=("-l ${SSHuser}")
scp_str+=("${SSHuser}@${host}")
crypt_str="dont-encrypt=yes"
fi
fi
-
+
log_msg="Create ${bin_tmp} file on ${RouterName}..."
log_info "${log_msg}"
log_msg="- Start download ${bin_tmp} file to ${BackupDir}..."
log_info "${log_msg}"
-
+
${SCP_STR}:/${bin_tmp} ${bin_name} >/dev/null & pid=$!
spinstr "$pid"
wait "$pid"
fi
log_msg="- Remove ${bin_tmp} file on ${RouterName}."
log_info "${log_msg}"
-
+
if ${SSH_STR} "/file remove [find name=${bin_tmp}]"; then
log_msg="- Remove ${bin_tmp} file on ${RouterName} complete succesfully!"
log_success "${log_msg}"
precedent_config=${BaseDir}"Precedent-Config.rsc"
current_config=${TempDir}"Config.rsc"
diff_config=${TempDir}"Diff-Config.rsc"
-bin_tmp="Binary.backup"
+bin_tmp=${TempDir}"Binary.backup"
log_msg="Set variables for ${RouterName} success!"
log_success "${log_msg}"
log_success "${log_msg}"
backup_binary ${bin_tmp} ${backup_pass}
-
+
cd "${BaseDir}"
-
+
CurrentHistoryDir=${HistoryDir}"${DStamp}/"
${CMD_MKD} -p ${CurrentHistoryDir}
diff_config_history=${CurrentHistoryDir}"${DTStamp}-Diff-Config.rsc"
log_msg="- Move ${diff_config} file to ${CurrentHistoryDir}."
log_info "${log_msg}"
-
+
if ${CMD_MV} -f ${diff_config} ${diff_config_history}; then
log_msg="- Move ${diff_config} file to ${CurrentHistoryDir} complete succesfully!"
log_success "${log_msg}"