Amxb_Ubus  3.3.1
Ambiorix Ubus API
forward_ubus_server.sh
Go to the documentation of this file.
1 #!/bin/sh -e
2 
3 if [ $# != 2 ]; then
4  echo "usage: $0 <port> <unix domain socket>"
5  echo "example: $0 1971 /var/run/ubus/ubus.sock"
6  exit 0
7 fi
8 
9 PUBLIC_PORT=$1
10 PRIVATE_SOCKET=$2
11 SOCAT_LOG=/tmp/socat-$PUBLIC_PORT.log
12 
13 echo "--> socat relay from port [$PUBLIC_PORT] to socket [$PRIVATE_SOCKET]"
14 echo "--> logs: $SOCAT_LOG"
15 
16 socat -d -d -lf $SOCAT_LOG TCP4-LISTEN:$PUBLIC_PORT,reuseaddr,fork UNIX-CONNECT:$PRIVATE_SOCKET