From 953c47a0e5144f0d53498b7e4955f05ffdd548e5 Mon Sep 17 00:00:00 2001 From: Florian Wallner Date: Wed, 13 Nov 2019 16:07:55 +0100 Subject: Extend the ssh configuration check by calling the echo command if the first check fails. Signed-off-by: Florian Wallner Signed-off-by: nachoparker --- bin/ncp/BACKUPS/nc-rsync-auto.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'bin') diff --git a/bin/ncp/BACKUPS/nc-rsync-auto.sh b/bin/ncp/BACKUPS/nc-rsync-auto.sh index 9e45f583..ed2510a1 100644 --- a/bin/ncp/BACKUPS/nc-rsync-auto.sh +++ b/bin/ncp/BACKUPS/nc-rsync-auto.sh @@ -28,10 +28,12 @@ configure() return 1; } + # Check if the ssh access is properly configured. For this purpose the command : or echo is called remotely. + # If one of the commands works, the test is successful. [[ "$DESTINATION" =~ : ]] && { local NET="$( sed 's|:.*||' <<<"$DESTINATION" )" local SSH=( ssh -o "BatchMode=yes" -p "$PORTNUMBER" "$NET" ) - ${SSH[@]} : || { echo "SSH non-interactive not properly configured"; return 1; } + ${SSH[@]} echo || { echo "SSH non-interactive not properly configured"; return 1; } } echo "0 5 */${SYNCDAYS} * * root /usr/bin/rsync -ax -e \"ssh -p $PORTNUMBER\" --delete \"$DATADIR\" \"$DESTINATION\"" > /etc/cron.d/ncp-rsync-auto -- cgit v1.2.3