Created
October 15, 2021 15:41
-
-
Save paolobrasolin/fe1bf0a8646fd9304223c216367b5ef6 to your computer and use it in GitHub Desktop.
Open an SSH tunnel to a PG socket
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
#!/usr/bin/env bash | |
DB=${1:-my-host} | |
PORT=${2:-10864} | |
echo "Opened tunnel on port $PORT to $DB through websocket..." | |
ssh -N -L localhost:$PORT:/var/run/postgresql/.s.PGSQL.5432 $DB | |
echo "Closed!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment