Skip to content
Snippets Groups Projects
startkBokehAndPrintIp.sh 806 B
Newer Older
#!/bin/bash

# Find the local IP address. This line gets the IP address associated with the default route.
LOCAL_IP=$(ip route get 1 | awk '{print $7;exit}')

# Print the local IP address
echo "Local IP Address: $LOCAL_IP"

# Define the initial Bokeh server command
CMD=("bokeh" "serve" "dsi-parser-frontend/" "--port" "5020" "--allow-websocket-origin" "*" "--use-xheaders" "--prefix" "dsi-parser-frontend")

# Execute the command
"${CMD[@]}"
EXIT_STATUS=$?

# Check if the command failed
if [ $EXIT_STATUS -ne 0 ]; then
    echo "Initial Bokeh server command failed. Attempting fallback command..."
    # Define and execute the fallback Bokeh server command
    CMD=("bokeh" "serve" "./" "--port" "5020" "--allow-websocket-origin" "*" "--use-xheaders" "--prefix" "dsi-parser-frontend")
    "${CMD[@]}"
fi