Created
May 22, 2018 03:43
-
-
Save davidoram/4995f6769b8a5f930ea9613fe4b65d20 to your computer and use it in GitHub Desktop.
Revisions
-
davidoram created this gist
May 22, 2018 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,23 @@ #!/bin/bash set -e if [ $# -ne 3 ]; then echo "Usage:" echo "" echo " `basename $0` <unix socket file> <host> <listen port>" echo "" echo "For example:" echo "" echo " `basename $0` /tmp/.s.PGSQL.5432 localhost 5432" echo "" echo "Will create a Unix socket at '/tmp/.s.PGSQL.5432' and connect it to TCP socket on 'localhost:5432'" echo "" exit fi SOCK=$1 HOST=$2 PORT=$3 socat -d -d -d -lf ${HOME}/tmp/socat.log UNIX-LISTEN:${SOCK},reuseaddr,fork TCP:${HOST}:${PORT}