Created
January 8, 2020 19:37
-
-
Save gadelkareem/fd9c1803d2d43fb35b132f547c2ef8fe to your computer and use it in GitHub Desktop.
Login hetzner by VM name
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -eo pipefail | |
READ_LINK=$([[ "$OSTYPE" == "darwin"* ]] && echo greadlink || echo readlink) | |
cd "$(dirname $(${READ_LINK} -f "${BASH_SOURCE[0]}"))/.." | |
IP=$(hcloud server list --selector "name=$1" --output noheader --output columns=IPV4) | |
echo Connecting to $1 IP: $IP | |
ssh -o CheckHostIP=no -o TCPKeepAlive=yes -o StrictHostKeyChecking=no -o ServerAliveInterval=120 -o ServerAliveCountMax=100 root@${IP} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment