File: rebind

package info (click to toggle)
websockify 0.13.0%2Bdfsg1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 588 kB
  • sloc: python: 3,287; ansic: 55; makefile: 32; sh: 28
file content (21 lines) | stat: -rwxr-xr-x 530 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/env bash

mydir="$(readlink -f "$(dirname "${0}")")"
mylib="${mydir}/../lib/websockify/rebind.so"
[ -e "${mylib}" ] || { echo "${mylib} not found" >&2; exit 1; }

usage() {
    echo "Usage: $(basename $0) OLD_PORT NEW_PORT COMMAND_LINE"
    echo
    echo "Launch COMMAND_LINE, but intercept system calls to bind"
    echo "to OLD_PORT and instead bind them to localhost:NEW_PORT"
    exit 2
}

# Parameter defaults

export REBIND_PORT_OLD="${1}"
export REBIND_PORT_NEW="${2}"
shift 2

LD_PRELOAD="${mylib}" exec "${@}"