-
-
Save AlexisDucastel/8d8630f00010aba27ded to your computer and use it in GitHub Desktop.
kssh
This file contains 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
#!/bin/bash | |
function die { echo "ERROR: $*"; exit 1; } | |
[ $# -lt 2 ] && die "Too few arguments" | |
KNOCKPORTS="$1" | |
shift | |
HOST="$1" | |
shift | |
for i in $KNOCKPORTS | |
do | |
echo "Knock $i ..." | |
nc -w 1 $HOST $i 2>/dev/null | |
done | |
ssh $HOST $@ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment