From 7f57b16a5875dc8789ea5cb5f67113d5fc01471a Mon Sep 17 00:00:00 2001 From: gyurix Date: Wed, 27 Aug 2025 11:10:23 +0200 Subject: [PATCH] Remove debug echo statements from SSH response checks in start_backup.sh --- start_backup.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/start_backup.sh b/start_backup.sh index 9b50667..1a167d6 100644 --- a/start_backup.sh +++ b/start_backup.sh @@ -58,14 +58,14 @@ fi for BACKUP in $( echo -n $SSH_HOST) ; do # check backup client availability RESPONSE=$(ssh -o StrictHostKeyChecking=no -o PreferredAuthentications=password -o ConnectTimeout=5 -o BatchMode=yes -p $SSH_PORT $SSH_USER@$BACKUP /bin/true 2>&1) - echo "RESPONSE: $RESPONSE" + if [ "$(echo $RESPONSE | grep -o resolve)" != "" ]; then echo "Expected backup client $BACKUP on port $SSH_PORT currently not available" continue fi # set backup client IP addresses and ports RESPONSE=$(ssh -o StrictHostKeyChecking=no -o PreferredAuthentications=password -o ConnectTimeout=5 -o BatchMode=yes -p $SSH_PORT $SSH_USER@$BACKUP /bin/true 2>&1) - echo "RESPONSE: $RESPONSE" + if [ "$(echo $RESPONSE | grep -o password)" != "" ]; then echo "SSH password authentication enabled" sshpass -p "$SSH_PASSWORD" ssh -p $SSH_PORT -i $SSH_DIR/id_$key_type $SSH_USER@$BACKUP "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys" < $SSH_DIR/id_$key_type.pub @@ -73,7 +73,7 @@ for BACKUP in $( echo -n $SSH_HOST) ; do sleep 2 fi RESPONSE=$(ssh -o StrictHostKeyChecking=no -o PreferredAuthentications=password -o ConnectTimeout=5 -o BatchMode=yes -p $SSH_PORT $SSH_USER@$BACKUP /bin/true 2>&1) - echo "RESPONSE: $RESPONSE" + if [ "$(echo $RESPONSE | grep -o password)" == "" ]; then echo "SSH password authentication is disabled on the server."