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

16 lines
360 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 \
-i ~/.ssh/alpine_hosts \
-o BatchMode=yes \
-o StrictHostKeyChecking=accept-new \
"$SSH_USER@$host" \
'hostname'
done