Switchign to rsync
This commit is contained in:
parent
384e2aa138
commit
a10783e281
@ -2,17 +2,15 @@
|
|||||||
|
|
||||||
# Checking if the key input is not empty
|
# Checking if the key input is not empty
|
||||||
if [[ "$INPUT_KEY" ]]; then
|
if [[ "$INPUT_KEY" ]]; then
|
||||||
# If it is not empty, it uses the key for the SCP
|
# If it is not empty, it uses the key for the rsync command
|
||||||
echo -e "${INPUT_KEY}" > key # Creates a file with the key content
|
echo -e "${INPUT_KEY}" > key # Creates a file with the key content
|
||||||
chmod 400 key # Set the key as Read-Only
|
chmod 400 key # Set the key as Read-Only
|
||||||
echo "Trying SCP process with SSH key"
|
|
||||||
|
rsync -e "ssh -p $INPUT_PORT -o StrictHostKeyChecking=no -i key" \
|
||||||
|
"$INPUT_ORIGIN" \
|
||||||
|
"$INPUT_USERNAME"@"$INPUT_HOST":"$INPUT_DESTINATION"
|
||||||
# Runs the SCP command
|
# Runs the SCP command
|
||||||
scp -rp -P $INPUT_PORT -o StrictHostKeyChecking=no -i key $INPUT_ORIGIN "$INPUT_USERNAME"@"$INPUT_HOST":"$INPUT_DESTINATION"
|
scp -i key $INPUT_ORIGIN "$INPUT_USERNAME"@"$INPUT_HOST":"$INPUT_DESTINATION"
|
||||||
else
|
|
||||||
# If the keyis empty, it uses the password for the SCP
|
|
||||||
echo "Trying SCP process with password"
|
|
||||||
# Runs the SCP command
|
|
||||||
sshpass -r -p $INPUT_PASSWORD scp -P $INPUT_PORT -o StrictHostKeyChecking=no $INPUT_ORIGIN "$INPUT_USERNAME"@"$INPUT_HOST":"$INPUT_DESTINATION"
|
|
||||||
fi
|
fi
|
||||||
time=$(date)
|
time=$(date)
|
||||||
echo "-----------------------------"
|
echo "-----------------------------"
|
||||||
|
Loading…
Reference in New Issue
Block a user