Fixed variable and log order + listen path
This commit is contained in:
@@ -33,10 +33,13 @@ echo "Starting socat proxy..."
|
|||||||
echo "UNIX socket: $UNIX_SOCKET_PATH"
|
echo "UNIX socket: $UNIX_SOCKET_PATH"
|
||||||
echo "TCP target: $TARGET_HOST:$TARGET_PORT"
|
echo "TCP target: $TARGET_HOST:$TARGET_PORT"
|
||||||
echo "HOST path: $HOST_SOCKET_PATH"
|
echo "HOST path: $HOST_SOCKET_PATH"
|
||||||
|
echo "Socket name: $UNIX_SOCKET_NAME"
|
||||||
|
|
||||||
|
# Calculate full socket path
|
||||||
|
FULL_SOCKET_PATH="$HOST_SOCKET_PATH/$UNIX_SOCKET_NAME"
|
||||||
echo "Full socket path: $FULL_SOCKET_PATH"
|
echo "Full socket path: $FULL_SOCKET_PATH"
|
||||||
|
|
||||||
# Check if socket file/folder exists and handle it
|
# Check if socket file/folder exists and handle it
|
||||||
FULL_SOCKET_PATH="$HOST_SOCKET_PATH/$UNIX_SOCKET_NAME"
|
|
||||||
if [ -e "$FULL_SOCKET_PATH" ]; then
|
if [ -e "$FULL_SOCKET_PATH" ]; then
|
||||||
echo "Socket file/folder $FULL_SOCKET_PATH exists, removing it..."
|
echo "Socket file/folder $FULL_SOCKET_PATH exists, removing it..."
|
||||||
if rm -rf "$FULL_SOCKET_PATH"; then
|
if rm -rf "$FULL_SOCKET_PATH"; then
|
||||||
@@ -89,7 +92,7 @@ trap cleanup SIGTERM SIGINT
|
|||||||
|
|
||||||
echo "Starting socat proxy..."
|
echo "Starting socat proxy..."
|
||||||
# Start socat with verbose logging and redirect to stdout/stderr
|
# Start socat with verbose logging and redirect to stdout/stderr
|
||||||
if socat -d -d UNIX-LISTEN:$UNIX_SOCKET_PATH,fork,unlink-early TCP:$TARGET_HOST:$TARGET_PORT & then
|
if socat -d -d UNIX-LISTEN:$FULL_SOCKET_PATH,fork,unlink-early TCP:$TARGET_HOST:$TARGET_PORT & then
|
||||||
SOCAT_PID=$!
|
SOCAT_PID=$!
|
||||||
echo "SUCCESS: Socat started with PID: $SOCAT_PID"
|
echo "SUCCESS: Socat started with PID: $SOCAT_PID"
|
||||||
echo "Container is ready and running..."
|
echo "Container is ready and running..."
|
||||||
|
Reference in New Issue
Block a user