Add find-your-casaos-ip-and-port

This commit is contained in:
Christopher
2023-09-25 14:39:11 -05:00
parent 6549961889
commit 9633b3d8ec
2 changed files with 22 additions and 0 deletions

View File

@@ -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)"
```

View File

@@ -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