Fix upload & checksum fail with Cygwin (for Windows)
This commit is contained in:
parent
9fc9c42f1a
commit
2c034253b4
91
src/ks-upa
91
src/ks-upa
|
@ -134,29 +134,43 @@ function showPathFile() {
|
||||||
function sendFile() {
|
function sendFile() {
|
||||||
correct=0
|
correct=0
|
||||||
countSend=0
|
countSend=0
|
||||||
|
toolSelected=$(cat ${dirConfig}/ks-upload-tool)
|
||||||
while [ ${correct} -eq 0 ] ; do
|
while [ ${correct} -eq 0 ] ; do
|
||||||
#sshpass -p ${1} scp ${2} ${3}@${4}:${5} &> /dev/null
|
# Run command for upload on Windows (Cygwin)
|
||||||
comandOne="sshpass -p ${1} rsync -azL -e"
|
|
||||||
comandTwo="--progress ${2} ${3}@${4}:${5}"
|
|
||||||
${comandOne} "ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" ${comandTwo} 2> /dev/null
|
|
||||||
sshpass -p ${1} ssh ${3}@${4} rm -rf ${5}/.${6}.* &> /dev/null
|
|
||||||
OUTPUT=$?
|
|
||||||
if [ "${cygwin}" == "yes" ] ; then
|
if [ "${cygwin}" == "yes" ] ; then
|
||||||
echo "retry_disabled" > /dev/null
|
if [ "${toolSelected}" == "rsync" ] ; then
|
||||||
correct=1
|
comandOne="/usr/bin/sshpass -p ${1} /usr/bin/rsync -azL -e"
|
||||||
else
|
comandTwo="--progress ${2} ${3}@${4}:${5}"
|
||||||
if [ ${OUTPUT} -ne 0 ] ; then
|
${comandOne} "/usr/bin/ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" ${comandTwo} 2> /dev/null
|
||||||
echo "Failure to send ${2}"
|
/usr/bin/sshpass -p ${1} /usr/bin/ssh ${3}@${4} rm -rf ${5}/.${6}.* &> /dev/null
|
||||||
echo "Retrying..."
|
OUTPUT=$?
|
||||||
sshpass -p ${1} ssh ${3}@${4} rm -rf ${5}/.${6}.* &> /dev/null
|
|
||||||
sleep 5
|
|
||||||
countSend=$(expr ${countSend} + 1)
|
|
||||||
if [ ${countSend} -eq 3 ] ; then
|
|
||||||
correct=1
|
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
|
/usr/bin/sshpass -p ${1} /usr/bin/scp ${2} ${3}@${4}:${5} 2> /dev/null
|
||||||
|
OUTPUT=$?
|
||||||
|
fi
|
||||||
|
# Run command for upload on Unix systems
|
||||||
|
else
|
||||||
|
if [ "${toolSelected}" == "rsync" ] ; then
|
||||||
|
comandOne="sshpass -p ${1} rsync -azL -e"
|
||||||
|
comandTwo="--progress ${2} ${3}@${4}:${5}"
|
||||||
|
${comandOne} "ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" ${comandTwo} 2> /dev/null
|
||||||
|
sshpass -p ${1} ssh ${3}@${4} rm -rf ${5}/.${6}.* &> /dev/null
|
||||||
|
OUTPUT=$?
|
||||||
|
else
|
||||||
|
sshpass -p ${1} scp ${2} ${3}@${4}:${5} 2> /dev/null
|
||||||
|
OUTPUT=$?
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if [ ${OUTPUT} -ne 0 ] ; then
|
||||||
|
echo "Failure to send ${2}"
|
||||||
|
echo "Retrying..."
|
||||||
|
sleep 5
|
||||||
|
countSend=$(expr ${countSend} + 1)
|
||||||
|
if [ ${countSend} -eq 3 ] ; then
|
||||||
correct=1
|
correct=1
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
correct=1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
@ -168,30 +182,30 @@ function checkChecksum() {
|
||||||
countChecksum=0
|
countChecksum=0
|
||||||
echo -n "Checking checksum... " && sleep 4
|
echo -n "Checking checksum... " && sleep 4
|
||||||
echo ""
|
echo ""
|
||||||
if [ "${cygwin}" == "yes" ] ; then
|
while [ ${correct} -eq 0 ] ; do
|
||||||
checksumLocal=$(md5sum ${2})
|
if [ "${cygwin}" == "yes" ] ; then
|
||||||
echo "Local checksum: ${checksumLocal}"
|
checksumLocal=$(/usr/bin/md5sum ${2})
|
||||||
echo "Server checksum: checksum_disabled"
|
checksumServer=$(/usr/bin/sshpass -p ${1} /usr/bin/ssh ${3}@${4} md5sum ${5} 2> /dev/null)
|
||||||
else
|
OUTPUT=$?
|
||||||
while [ ${correct} -eq 0 ] ; do
|
else
|
||||||
|
checksumLocal=$(md5sum ${2})
|
||||||
checksumServer=$(sshpass -p ${1} ssh ${3}@${4} md5sum ${5} 2> /dev/null)
|
checksumServer=$(sshpass -p ${1} ssh ${3}@${4} md5sum ${5} 2> /dev/null)
|
||||||
OUTPUT=$?
|
OUTPUT=$?
|
||||||
if [ ${OUTPUT} -ne 0 ] ; then
|
fi
|
||||||
echo "Failed to get checksum for ${5}"
|
if [ ${OUTPUT} -ne 0 ] ; then
|
||||||
echo "Retrying..."
|
echo "Failed to get checksum for ${5}"
|
||||||
sleep 5
|
echo "Retrying..."
|
||||||
countChecksum=$(expr ${countChecksum} + 1)
|
sleep 5
|
||||||
if [ ${countChecksum} -eq 3 ] ; then
|
countChecksum=$(expr ${countChecksum} + 1)
|
||||||
correct=1
|
if [ ${countChecksum} -eq 3 ] ; then
|
||||||
fi
|
|
||||||
else
|
|
||||||
checksumLocal=$(md5sum ${2})
|
|
||||||
echo "Local checksum: ${checksumLocal}"
|
|
||||||
echo "Server checksum: ${checksumServer}"
|
|
||||||
correct=1
|
correct=1
|
||||||
fi
|
fi
|
||||||
done
|
else
|
||||||
fi
|
echo "Local checksum: ${checksumLocal}"
|
||||||
|
echo "Server checksum: ${checksumServer}"
|
||||||
|
correct=1
|
||||||
|
fi
|
||||||
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
# Generate random codes
|
# Generate random codes
|
||||||
|
@ -571,6 +585,7 @@ if [ "${1}" == "-r" ] ; then
|
||||||
echo "+ Removing LOCAL PATH file configuration..."
|
echo "+ Removing LOCAL PATH file configuration..."
|
||||||
rm -rf ${dirConfig}/ks-upload-dirlocal
|
rm -rf ${dirConfig}/ks-upload-dirlocal
|
||||||
echo "* Removed all configuration"
|
echo "* Removed all configuration"
|
||||||
|
rm -f ${dirConfig}/ks-upload-tool
|
||||||
echo ""
|
echo ""
|
||||||
exit
|
exit
|
||||||
else
|
else
|
||||||
|
|
91
src/ks-upf
91
src/ks-upf
|
@ -152,29 +152,43 @@ function showPathFile() {
|
||||||
function sendFile() {
|
function sendFile() {
|
||||||
correct=0
|
correct=0
|
||||||
countSend=0
|
countSend=0
|
||||||
|
toolSelected=$(cat ${dirConfig}/ks-upload-tool)
|
||||||
while [ ${correct} -eq 0 ] ; do
|
while [ ${correct} -eq 0 ] ; do
|
||||||
#sshpass -p ${1} scp ${2} ${3}@${4}:${5} &> /dev/null
|
# Run command for upload on Windows (Cygwin)
|
||||||
comandOne="sshpass -p ${1} rsync -azL -e"
|
|
||||||
comandTwo="--progress ${2} ${3}@${4}:${5}"
|
|
||||||
${comandOne} "ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" ${comandTwo} 2> /dev/null
|
|
||||||
sshpass -p ${1} ssh ${3}@${4} rm -rf ${5}/.${6}.* &> /dev/null
|
|
||||||
OUTPUT=$?
|
|
||||||
if [ "${cygwin}" == "yes" ] ; then
|
if [ "${cygwin}" == "yes" ] ; then
|
||||||
echo "retry_disabled" > /dev/null
|
if [ "${toolSelected}" == "rsync" ] ; then
|
||||||
correct=1
|
comandOne="/usr/bin/sshpass -p ${1} /usr/bin/rsync -azL -e"
|
||||||
else
|
comandTwo="--progress ${2} ${3}@${4}:${5}"
|
||||||
if [ ${OUTPUT} -ne 0 ] ; then
|
${comandOne} "/usr/bin/ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" ${comandTwo} 2> /dev/null
|
||||||
echo "Failure to send ${2}"
|
/usr/bin/sshpass -p ${1} /usr/bin/ssh ${3}@${4} rm -rf ${5}/.${6}.* &> /dev/null
|
||||||
echo "Retrying..."
|
OUTPUT=$?
|
||||||
sshpass -p ${1} ssh ${3}@${4} rm -rf ${5}/.${6}.* &> /dev/null
|
|
||||||
sleep 5
|
|
||||||
countSend=$(expr ${countSend} + 1)
|
|
||||||
if [ ${countSend} -eq 3 ] ; then
|
|
||||||
correct=1
|
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
|
/usr/bin/sshpass -p ${1} /usr/bin/scp ${2} ${3}@${4}:${5} 2> /dev/null
|
||||||
|
OUTPUT=$?
|
||||||
|
fi
|
||||||
|
# Run command for upload on Unix systems
|
||||||
|
else
|
||||||
|
if [ "${toolSelected}" == "rsync" ] ; then
|
||||||
|
comandOne="sshpass -p ${1} rsync -azL -e"
|
||||||
|
comandTwo="--progress ${2} ${3}@${4}:${5}"
|
||||||
|
${comandOne} "ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" ${comandTwo} 2> /dev/null
|
||||||
|
sshpass -p ${1} ssh ${3}@${4} rm -rf ${5}/.${6}.* &> /dev/null
|
||||||
|
OUTPUT=$?
|
||||||
|
else
|
||||||
|
sshpass -p ${1} scp ${2} ${3}@${4}:${5} 2> /dev/null
|
||||||
|
OUTPUT=$?
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if [ ${OUTPUT} -ne 0 ] ; then
|
||||||
|
echo "Failure to send ${2}"
|
||||||
|
echo "Retrying..."
|
||||||
|
sleep 5
|
||||||
|
countSend=$(expr ${countSend} + 1)
|
||||||
|
if [ ${countSend} -eq 3 ] ; then
|
||||||
correct=1
|
correct=1
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
correct=1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
@ -186,30 +200,30 @@ function checkChecksum() {
|
||||||
countChecksum=0
|
countChecksum=0
|
||||||
echo -n "Checking checksum... " && sleep 4
|
echo -n "Checking checksum... " && sleep 4
|
||||||
echo ""
|
echo ""
|
||||||
if [ "${cygwin}" == "yes" ] ; then
|
while [ ${correct} -eq 0 ] ; do
|
||||||
checksumLocal=$(md5sum ${2})
|
if [ "${cygwin}" == "yes" ] ; then
|
||||||
echo "Local checksum: ${checksumLocal}"
|
checksumLocal=$(/usr/bin/md5sum ${2})
|
||||||
echo "Server checksum: checksum_disabled"
|
checksumServer=$(/usr/bin/sshpass -p ${1} /usr/bin/ssh ${3}@${4} md5sum ${5} 2> /dev/null)
|
||||||
else
|
OUTPUT=$?
|
||||||
while [ ${correct} -eq 0 ] ; do
|
else
|
||||||
|
checksumLocal=$(md5sum ${2})
|
||||||
checksumServer=$(sshpass -p ${1} ssh ${3}@${4} md5sum ${5} 2> /dev/null)
|
checksumServer=$(sshpass -p ${1} ssh ${3}@${4} md5sum ${5} 2> /dev/null)
|
||||||
OUTPUT=$?
|
OUTPUT=$?
|
||||||
if [ ${OUTPUT} -ne 0 ] ; then
|
fi
|
||||||
echo "Failed to get checksum for ${5}"
|
if [ ${OUTPUT} -ne 0 ] ; then
|
||||||
echo "Retrying..."
|
echo "Failed to get checksum for ${5}"
|
||||||
sleep 5
|
echo "Retrying..."
|
||||||
countChecksum=$(expr ${countChecksum} + 1)
|
sleep 5
|
||||||
if [ ${countChecksum} -eq 3 ] ; then
|
countChecksum=$(expr ${countChecksum} + 1)
|
||||||
correct=1
|
if [ ${countChecksum} -eq 3 ] ; then
|
||||||
fi
|
|
||||||
else
|
|
||||||
checksumLocal=$(md5sum ${2})
|
|
||||||
echo "Local checksum: ${checksumLocal}"
|
|
||||||
echo "Server checksum: ${checksumServer}"
|
|
||||||
correct=1
|
correct=1
|
||||||
fi
|
fi
|
||||||
done
|
else
|
||||||
fi
|
echo "Local checksum: ${checksumLocal}"
|
||||||
|
echo "Server checksum: ${checksumServer}"
|
||||||
|
correct=1
|
||||||
|
fi
|
||||||
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
# Generate random codes
|
# Generate random codes
|
||||||
|
@ -589,6 +603,7 @@ if [ "${1}" == "-r" ] ; then
|
||||||
echo "+ Removing LOCAL PATH file configuration..."
|
echo "+ Removing LOCAL PATH file configuration..."
|
||||||
rm -rf ${dirConfig}/ks-upload-dirlocal
|
rm -rf ${dirConfig}/ks-upload-dirlocal
|
||||||
echo "* Removed all configuration"
|
echo "* Removed all configuration"
|
||||||
|
rm -f ${dirConfig}/ks-upload-tool
|
||||||
echo ""
|
echo ""
|
||||||
exit
|
exit
|
||||||
else
|
else
|
||||||
|
|
35
src/ks-upr
35
src/ks-upr
|
@ -147,11 +147,35 @@ function showPathFile() {
|
||||||
# Function to send file to server.
|
# Function to send file to server.
|
||||||
# Syntax: sendFile <password> <file path> <user> <server> <server path> [file name]
|
# Syntax: sendFile <password> <file path> <user> <server> <server path> [file name]
|
||||||
function sendFile() {
|
function sendFile() {
|
||||||
#sshpass -p ${1} scp ${2} ${3}@${4}:${5} &> /dev/null
|
toolSelected=$(cat ${dirConfig}/ks-upload-tool)
|
||||||
comandOne="sshpass -p ${1} rsync -azlr -e"
|
if [ "${cygwin}" == "yes" ] ; then
|
||||||
comandTwo="--progress ${2}/ ${3}@${4}:${5}/"
|
if [ "${toolSelected}" == "rsync" ] ; then
|
||||||
${comandOne} "ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" ${comandTwo} 2> /dev/null
|
echo ""
|
||||||
sshpass -p ${1} ssh ${3}@${4} rm -rf ${5}/.${6}.* &> /dev/null
|
echo "+ Syncing folder ${2} to ${5} (${4})"
|
||||||
|
comandOne="/usr/bin/sshpass -p ${1} /usr/bin/rsync -azL -e"
|
||||||
|
comandTwo="--progress ${2}/ ${3}@${4}:${5}/"
|
||||||
|
${comandOne} "/usr/bin/ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" ${comandTwo} 2> /dev/null
|
||||||
|
/usr/bin/sshpass -p ${1} /usr/bin/ssh ${3}@${4} rm -rf ${5}/.${6}.* &> /dev/null
|
||||||
|
else
|
||||||
|
echo ""
|
||||||
|
echo "+ Sending files from ${2} to ${5} (${4})"
|
||||||
|
/usr/bin/sshpass -p ${1} /usr/bin/scp ${2}/* ${3}@${4}:${5}/ 2> /dev/null
|
||||||
|
fi
|
||||||
|
# Run command for upload on Unix systems
|
||||||
|
else
|
||||||
|
if [ "${toolSelected}" == "rsync" ] ; then
|
||||||
|
echo ""
|
||||||
|
echo "+ Syncing folder ${2} to ${5} (${4})"
|
||||||
|
comandOne="sshpass -p ${1} rsync -azlr -e"
|
||||||
|
comandTwo="--progress ${2}/ ${3}@${4}:${5}/"
|
||||||
|
${comandOne} "ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" ${comandTwo} 2> /dev/null
|
||||||
|
sshpass -p ${1} ssh ${3}@${4} rm -rf ${5}/.${6}.* &> /dev/null
|
||||||
|
else
|
||||||
|
echo ""
|
||||||
|
echo "+ Sending files from ${2} to ${5} (${4})"
|
||||||
|
sshpass -p ${1} scp -r ${2}/* ${3}@${4}:${5}/ 2> /dev/null
|
||||||
|
fi
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Generate random codes
|
# Generate random codes
|
||||||
|
@ -531,6 +555,7 @@ if [ "${1}" == "-r" ] ; then
|
||||||
echo "+ Removing LOCAL PATH file configuration..."
|
echo "+ Removing LOCAL PATH file configuration..."
|
||||||
rm -rf ${dirConfig}/ks-upload-dirlocal
|
rm -rf ${dirConfig}/ks-upload-dirlocal
|
||||||
echo "* Removed all configuration"
|
echo "* Removed all configuration"
|
||||||
|
rm -f ${dirConfig}/ks-upload-tool
|
||||||
echo ""
|
echo ""
|
||||||
exit
|
exit
|
||||||
else
|
else
|
||||||
|
|
92
src/ks-upv
92
src/ks-upv
|
@ -129,35 +129,48 @@ function showPathFile() {
|
||||||
echo ${pathFile}
|
echo ${pathFile}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Function to send file to server.
|
# Function to send file to server.
|
||||||
# Syntax: sendFile <password> <file path> <user> <server> <server path> [file name]
|
# Syntax: sendFile <password> <file path> <user> <server> <server path> [file name]
|
||||||
function sendFile() {
|
function sendFile() {
|
||||||
correct=0
|
correct=0
|
||||||
countSend=0
|
countSend=0
|
||||||
|
toolSelected=$(cat ${dirConfig}/ks-upload-tool)
|
||||||
while [ ${correct} -eq 0 ] ; do
|
while [ ${correct} -eq 0 ] ; do
|
||||||
#sshpass -p ${1} scp ${2} ${3}@${4}:${5} &> /dev/null
|
# Run command for upload on Windows (Cygwin)
|
||||||
comandOne="sshpass -p ${1} rsync -azL -e"
|
|
||||||
comandTwo="--progress ${2} ${3}@${4}:${5}"
|
|
||||||
${comandOne} "ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" ${comandTwo} 2> /dev/null
|
|
||||||
sshpass -p ${1} ssh ${3}@${4} rm -rf ${5}/.${6}.* &> /dev/null
|
|
||||||
OUTPUT=$?
|
|
||||||
if [ "${cygwin}" == "yes" ] ; then
|
if [ "${cygwin}" == "yes" ] ; then
|
||||||
echo "retry_disabled" > /dev/null
|
if [ "${toolSelected}" == "rsync" ] ; then
|
||||||
correct=1
|
comandOne="/usr/bin/sshpass -p ${1} /usr/bin/rsync -azL -e"
|
||||||
else
|
comandTwo="--progress ${2} ${3}@${4}:${5}"
|
||||||
if [ ${OUTPUT} -ne 0 ] ; then
|
${comandOne} "/usr/bin/ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" ${comandTwo} 2> /dev/null
|
||||||
echo "Failure to send ${2}"
|
/usr/bin/sshpass -p ${1} /usr/bin/ssh ${3}@${4} rm -rf ${5}/.${6}.* &> /dev/null
|
||||||
echo "Retrying..."
|
OUTPUT=$?
|
||||||
sshpass -p ${1} ssh ${3}@${4} rm -rf ${5}/.${6}.* &> /dev/null
|
|
||||||
sleep 5
|
|
||||||
countSend=$(expr ${countSend} + 1)
|
|
||||||
if [ ${countSend} -eq 3 ] ; then
|
|
||||||
correct=1
|
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
|
/usr/bin/sshpass -p ${1} /usr/bin/scp ${2} ${3}@${4}:${5} 2> /dev/null
|
||||||
|
OUTPUT=$?
|
||||||
|
fi
|
||||||
|
# Run command for upload on Unix systems
|
||||||
|
else
|
||||||
|
if [ "${toolSelected}" == "rsync" ] ; then
|
||||||
|
comandOne="sshpass -p ${1} rsync -azL -e"
|
||||||
|
comandTwo="--progress ${2} ${3}@${4}:${5}"
|
||||||
|
${comandOne} "ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" ${comandTwo} 2> /dev/null
|
||||||
|
sshpass -p ${1} ssh ${3}@${4} rm -rf ${5}/.${6}.* &> /dev/null
|
||||||
|
OUTPUT=$?
|
||||||
|
else
|
||||||
|
sshpass -p ${1} scp ${2} ${3}@${4}:${5} 2> /dev/null
|
||||||
|
OUTPUT=$?
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if [ ${OUTPUT} -ne 0 ] ; then
|
||||||
|
echo "Failure to send ${2}"
|
||||||
|
echo "Retrying..."
|
||||||
|
sleep 5
|
||||||
|
countSend=$(expr ${countSend} + 1)
|
||||||
|
if [ ${countSend} -eq 3 ] ; then
|
||||||
correct=1
|
correct=1
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
correct=1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
@ -169,30 +182,30 @@ function checkChecksum() {
|
||||||
countChecksum=0
|
countChecksum=0
|
||||||
echo -n "Checking checksum... " && sleep 4
|
echo -n "Checking checksum... " && sleep 4
|
||||||
echo ""
|
echo ""
|
||||||
if [ "${cygwin}" == "yes" ] ; then
|
while [ ${correct} -eq 0 ] ; do
|
||||||
checksumLocal=$(md5sum ${2})
|
if [ "${cygwin}" == "yes" ] ; then
|
||||||
echo "Local checksum: ${checksumLocal}"
|
checksumLocal=$(/usr/bin/md5sum ${2})
|
||||||
echo "Server checksum: checksum_disabled"
|
checksumServer=$(/usr/bin/sshpass -p ${1} /usr/bin/ssh ${3}@${4} md5sum ${5} 2> /dev/null)
|
||||||
else
|
OUTPUT=$?
|
||||||
while [ ${correct} -eq 0 ] ; do
|
else
|
||||||
|
checksumLocal=$(md5sum ${2})
|
||||||
checksumServer=$(sshpass -p ${1} ssh ${3}@${4} md5sum ${5} 2> /dev/null)
|
checksumServer=$(sshpass -p ${1} ssh ${3}@${4} md5sum ${5} 2> /dev/null)
|
||||||
OUTPUT=$?
|
OUTPUT=$?
|
||||||
if [ ${OUTPUT} -ne 0 ] ; then
|
fi
|
||||||
echo "Failed to get checksum for ${5}"
|
if [ ${OUTPUT} -ne 0 ] ; then
|
||||||
echo "Retrying..."
|
echo "Failed to get checksum for ${5}"
|
||||||
sleep 5
|
echo "Retrying..."
|
||||||
countChecksum=$(expr ${countChecksum} + 1)
|
sleep 5
|
||||||
if [ ${countChecksum} -eq 3 ] ; then
|
countChecksum=$(expr ${countChecksum} + 1)
|
||||||
correct=1
|
if [ ${countChecksum} -eq 3 ] ; then
|
||||||
fi
|
|
||||||
else
|
|
||||||
checksumLocal=$(md5sum ${2})
|
|
||||||
echo "Local checksum: ${checksumLocal}"
|
|
||||||
echo "Server checksum: ${checksumServer}"
|
|
||||||
correct=1
|
correct=1
|
||||||
fi
|
fi
|
||||||
done
|
else
|
||||||
fi
|
echo "Local checksum: ${checksumLocal}"
|
||||||
|
echo "Server checksum: ${checksumServer}"
|
||||||
|
correct=1
|
||||||
|
fi
|
||||||
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
# Generate random codes
|
# Generate random codes
|
||||||
|
@ -572,6 +585,7 @@ if [ "${1}" == "-r" ] ; then
|
||||||
echo "+ Removing LOCAL PATH file configuration..."
|
echo "+ Removing LOCAL PATH file configuration..."
|
||||||
rm -rf ${dirConfig}/ks-upload-dirlocal
|
rm -rf ${dirConfig}/ks-upload-dirlocal
|
||||||
echo "* Removed all configuration"
|
echo "* Removed all configuration"
|
||||||
|
rm -f ${dirConfig}/ks-upload-tool
|
||||||
echo ""
|
echo ""
|
||||||
exit
|
exit
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue
Block a user