mirror of
https://github.com/vmstan/gravity-sync.git
synced 2024-08-30 18:22:11 +00:00
Rewrite SSH function
This commit is contained in:
parent
89740497e9
commit
8cfdd15392
@ -625,8 +625,7 @@ function validate_os_sshpass {
|
|||||||
CMD_TIMEOUT='5'
|
CMD_TIMEOUT='5'
|
||||||
CMD_REQUESTED="exit"
|
CMD_REQUESTED="exit"
|
||||||
create_sshcmd
|
create_sshcmd
|
||||||
${SSH_SEND} >/dev/null 2>&1
|
|
||||||
error_validate
|
|
||||||
}
|
}
|
||||||
|
|
||||||
## Determine SSH Pathways
|
## Determine SSH Pathways
|
||||||
@ -635,13 +634,16 @@ function create_sshcmd {
|
|||||||
then
|
then
|
||||||
if [ -z "$SSHPASSWORD" ]
|
if [ -z "$SSHPASSWORD" ]
|
||||||
then
|
then
|
||||||
SSH_SEND="timeout --preserve-status ${CMD_TIMEOUT} ${SSH_CMD} -p ${SSH_PORT} -i $HOME/${SSH_PKIF} -o StrictHostKeyChecking=no ${REMOTE_USER}@${REMOTE_HOST} '${CMD_REQUESTED}'"
|
timeout --preserve-status ${CMD_TIMEOUT} ${SSH_CMD} -p ${SSH_PORT} -i $HOME/${SSH_PKIF} -o StrictHostKeyChecking=no ${REMOTE_USER}@${REMOTE_HOST} "${CMD_REQUESTED}"
|
||||||
|
error_validate
|
||||||
else
|
else
|
||||||
SSH_SEND="timeout --preserve-status ${CMD_TIMEOUT} ${SSHPASSWORD} ${SSH_CMD} -p ${SSH_PORT} -o StrictHostKeyChecking=no ${REMOTE_USER}@${REMOTE_HOST} '${CMD_REQUESTED}'"
|
timeout --preserve-status ${CMD_TIMEOUT} ${SSHPASSWORD} ${SSH_CMD} -p ${SSH_PORT} -o StrictHostKeyChecking=no ${REMOTE_USER}@${REMOTE_HOST} "${CMD_REQUESTED}"
|
||||||
|
error_validate
|
||||||
fi
|
fi
|
||||||
elif hash dbclient 2>/dev/null
|
elif hash dbclient 2>/dev/null
|
||||||
then
|
then
|
||||||
SSH_SEND="timeout --preserve-status ${CMD_TIMEOUT} ${SSH_CMD} -p ${SSH_PORT} -i $HOME/${SSH_PKIF} ${REMOTE_USER}@${REMOTE_HOST} \"${CMD_REQUESTED}\""
|
timeout --preserve-status ${CMD_TIMEOUT} ${SSH_CMD} -p ${SSH_PORT} -i $HOME/${SSH_PKIF} ${REMOTE_USER}@${REMOTE_HOST} "${CMD_REQUESTED}"
|
||||||
|
error_validate
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -651,15 +653,15 @@ function create_rsynccmd {
|
|||||||
then
|
then
|
||||||
if [ -z "$SSHPASSWORD" ]
|
if [ -z "$SSHPASSWORD" ]
|
||||||
then
|
then
|
||||||
rsync -e "${SSH_CMD} -p ${SSH_PORT} -i $HOME/${SSH_PKIF}" ${REMOTE_USER}@${REMOTE_HOST}:${RSYNC_SOURCE} ${RSYNC_TARGET}
|
rsync -e "${SSH_CMD} -p ${SSH_PORT} -i $HOME/${SSH_PKIF}" ${REMOTE_USER}@${REMOTE_HOST}:${RSYNC_SOURCE} ${RSYNC_TARGET} >/dev/null 2>&1
|
||||||
error_validate
|
error_validate
|
||||||
else
|
else
|
||||||
rsync -e "${SSHPASSWORD} ${SSH_CMD} -p ${SSH_PORT} -i $HOME/${SSH_PKIF}" ${REMOTE_USER}@${REMOTE_HOST}:${RSYNC_SOURCE} ${RSYNC_TARGET}
|
rsync -e "${SSHPASSWORD} ${SSH_CMD} -p ${SSH_PORT} -i $HOME/${SSH_PKIF}" ${REMOTE_USER}@${REMOTE_HOST}:${RSYNC_SOURCE} ${RSYNC_TARGET} >/dev/null 2>&1
|
||||||
error_validate
|
error_validate
|
||||||
fi
|
fi
|
||||||
elif hash dbclient 2>/dev/null
|
elif hash dbclient 2>/dev/null
|
||||||
then
|
then
|
||||||
rsync -e "${SSH_CMD} -p ${SSH_PORT} -i $HOME/${SSH_PKIF}" ${REMOTE_USER}@${REMOTE_HOST}:${RSYNC_SOURCE} ${RSYNC_TARGET}
|
rsync -e "${SSH_CMD} -p ${SSH_PORT} -i $HOME/${SSH_PKIF}" ${REMOTE_USER}@${REMOTE_HOST}:${RSYNC_SOURCE} ${RSYNC_TARGET} >/dev/null 2>&1
|
||||||
error_validate
|
error_validate
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user