Fix SSH user in lab status command
This commit is contained in:
parent
53480c72bc
commit
38bc909c6a
1 changed files with 18 additions and 2 deletions
|
@ -128,13 +128,29 @@ writeShellScriptBin "lab" ''
|
|||
warn " congenital-optimist: ⚠ Tailscale inactive"
|
||||
fi
|
||||
|
||||
# Check if -v (verbose) flag is passed
|
||||
local verbose=0
|
||||
if [[ "''${1:-}" == "-v" ]]; then
|
||||
verbose=1
|
||||
fi
|
||||
|
||||
# Check remote machines
|
||||
for machine in sleeper-service grey-area reverse-proxy; do
|
||||
local ssh_user="sma" # Using sma as the admin user for remote machines
|
||||
|
||||
# Test SSH connectivity with debug info if in verbose mode
|
||||
if [[ $verbose -eq 1 ]]; then
|
||||
log "Testing LAN connection to $machine..."
|
||||
${openssh}/bin/ssh -v -o ConnectTimeout=2 -o BatchMode=yes "$ssh_user@$machine" "echo OK" || true
|
||||
log "Testing Tailscale connection to $machine.tailnet..."
|
||||
${openssh}/bin/ssh -v -o ConnectTimeout=2 -o BatchMode=yes "$ssh_user@$machine.tailnet" "echo OK" || true
|
||||
fi
|
||||
|
||||
# Try with normal SSH first (for LAN)
|
||||
if ${openssh}/bin/ssh -o ConnectTimeout=2 -o BatchMode=yes "sma@$machine" "echo OK" >/dev/null 2>&1; then
|
||||
if ${openssh}/bin/ssh -o ConnectTimeout=2 -o BatchMode=yes "$ssh_user@$machine" "echo OK" >/dev/null 2>&1; then
|
||||
success " $machine: ✓ Online (LAN)"
|
||||
# Try with Tailscale hostname as fallback
|
||||
elif ${openssh}/bin/ssh -o ConnectTimeout=2 -o BatchMode=yes "sma@$machine.tailnet" "echo OK" >/dev/null 2>&1; then
|
||||
elif ${openssh}/bin/ssh -o ConnectTimeout=2 -o BatchMode=yes "$ssh_user@$machine.tailnet" "echo OK" >/dev/null 2>&1; then
|
||||
success " $machine: ✓ Online (Tailscale)"
|
||||
else
|
||||
warn " $machine: ⚠ Unreachable"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue