Skip to content
Snippets Groups Projects
Commit 56d555c2 authored by Benedikt's avatar Benedikt
Browse files

tryed opther ip discover methode

parent 3c92ab9b
No related branches found
No related tags found
No related merge requests found
#!/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}')
#!/bin/bash
# Function to print IP addresses using ip command
function print_ips_with_ip() {
echo "IP addresses on this machine:"
ip -4 addr show | grep -oP '(?<=inet\s)\d+(\.\d+){3}'
}
# Print the local IP address
echo "Local IP Address: $LOCAL_IP"
# Function to print IP addresses using ifconfig command
function print_ips_with_ifconfig() {
echo "IP addresses on this machine:"
ifconfig | grep -o 'inet addr:\S*' | cut -d':' -f2
}
# Check if ip command is available and use it, otherwise try ifconfig
if command -v ip >/dev/null 2>&1; then
print_ips_with_ip
elif command -v ifconfig >/dev/null 2>&1; then
print_ips_with_ifconfig
else
echo "No tool available to find IP addresses."
fi
# Define the initial Bokeh server command
CMD=("bokeh" "serve" "dsi-parser-frontend/" "--port" "5020" "--allow-websocket-origin" "*" "--use-xheaders" "--prefix" "dsi-parser-frontend")
......@@ -19,4 +36,4 @@ if [ $EXIT_STATUS -ne 0 ]; then
# Define and execute the fallback Bokeh server command
CMD=("bokeh" "serve" "./" "--port" "5020" "--allow-websocket-origin" "*" "--use-xheaders" "--prefix" "dsi-parser-frontend")
"${CMD[@]}"
fi
fi
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment