Guest User

Untitled

a guest
May 26th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. set -e
  4.  
  5. if [ $# -ne 3 ]; then
  6. echo "Usage:"
  7. echo ""
  8. echo " `basename $0` <unix socket file> <host> <listen port>"
  9. echo ""
  10. echo "For example:"
  11. echo ""
  12. echo " `basename $0` /tmp/.s.PGSQL.5432 localhost 5432"
  13. echo ""
  14. echo "Will create a Unix socket at '/tmp/.s.PGSQL.5432' and connect it to TCP socket on 'localhost:5432'"
  15. echo ""
  16. exit
  17. fi
  18.  
  19. SOCK=$1
  20. HOST=$2
  21. PORT=$3
  22.  
  23. socat -d -d -d -lf ${HOME}/tmp/socat.log UNIX-LISTEN:${SOCK},reuseaddr,fork TCP:${HOST}:${PORT}
Add Comment
Please, Sign In to add comment