Files
bash/check-host.sh
T
2026-10-10 01:13:30 +08:00

15 lines
327 B
Bash

#!/bin/bash
set -euo pipefail
: "${TARGET_HOSTS:?TARGET_HOSTS is not configured}"
: "${SSH_USER:?SSH_USER is not configured}"
for host in $TARGET_HOSTS; do
echo "Connecting to $host..."
ssh \
-o BatchMode=yes \
-o StrictHostKeyChecking=accept-new \
"$SSH_USER@$host" \
'hostname'
done