broken-mobile-server/initRVP_http.sh
2024-06-02 20:49:41 +00:00

18 lines
578 B
Bash

# Set the target host and port
TARGET_HOST="androidnasserver1"
TARGET_PORT="80"
LOCAL_PORT="8080"
SERVEO_DOMAIN="serveo.net"
EXISTING_SSH_PID=$(pgrep -f "ssh -R 80:localhost:8080 serveo.net")
echo $EXISTING_SSH_PID
if ! [ -n "$EXISTING_SSH_PID" ]; then
# Start reverse port forwarding in the background
ssh -R $TARGET_HOST:$TARGET_PORT:127.0.0.1:$LOCAL_PORT $SERVEO_DOMAIN > /data/data/com.termux/files/home/.cronlog/cronlog.txt 2>&1 &
nohup caddy reverse-proxy --from :2638 --to :8080
fi