From 9633b3d8ec9f9a7c86df5fdb6068165bd09f88e8 Mon Sep 17 00:00:00 2001 From: Christopher Date: Mon, 25 Sep 2023 14:39:11 -0500 Subject: [PATCH] Add find-your-casaos-ip-and-port --- find-your-casaos-ip-and-port/README.md | 5 +++++ find-your-casaos-ip-and-port/run.sh | 17 +++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 find-your-casaos-ip-and-port/README.md create mode 100644 find-your-casaos-ip-and-port/run.sh diff --git a/find-your-casaos-ip-and-port/README.md b/find-your-casaos-ip-and-port/README.md new file mode 100644 index 0000000..23fd951 --- /dev/null +++ b/find-your-casaos-ip-and-port/README.md @@ -0,0 +1,5 @@ +# Run command + +```bash +bash -c "$(wget -qLO - https://raw.githubusercontent.com/bigbeartechworld/big-bear-scripts/master/find-your-casaos-ip-and-port/run.sh)" +``` diff --git a/find-your-casaos-ip-and-port/run.sh b/find-your-casaos-ip-and-port/run.sh new file mode 100644 index 0000000..a27ec6e --- /dev/null +++ b/find-your-casaos-ip-and-port/run.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +# Path to the configuration file +CONFIG_FILE="/etc/casaos/gateway.ini" + +# Check if the configuration file exists +if [[ -f $CONFIG_FILE ]]; then + # Use grep to find the line with 'port' and use awk to print the value + PORT=$(grep '^port=' $CONFIG_FILE | awk -F'=' '{print $2}') + # Get the local IP address + IP_ADDR=$(hostname -I | awk '{print $1}') + echo "The local IP address is: $IP_ADDR" + echo "The port number is: $PORT" + echo "You can access it in the browser at: http://$IP_ADDR:$PORT" +else + echo "Error: Configuration file not found." +fi