diff --git a/change-casaos-web-ui-port/README.md b/change-casaos-web-ui-port/README.md new file mode 100644 index 0000000..b6b61bc --- /dev/null +++ b/change-casaos-web-ui-port/README.md @@ -0,0 +1,5 @@ +# Run command + +```bash +bash -c "$(wget -qLO - https://raw.githubusercontent.com/bigbeartechworld/big-bear-scripts/master/change-casaos-web-ui-port/run.sh)" +``` diff --git a/change-casaos-web-ui-port/run.sh b/change-casaos-web-ui-port/run.sh new file mode 100644 index 0000000..3adbdb9 --- /dev/null +++ b/change-casaos-web-ui-port/run.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +# Ask the user for the new port number +read -p "Enter the new port number for CasaOS: " new_port + +# Check if the input is a valid number +if ! [[ "$new_port" =~ ^[0-9]+$ ]]; then + echo "Error: Please enter a valid port number." + exit 1 +fi + +# Backup the original configuration file +cp /etc/casaos/gateway.conf /etc/casaos/gateway.conf.bak + +# Change the port number in the configuration file +sed -i "s/^port=[0-9]\+/port=$new_port/" /etc/casaos/gateway.conf + +# Restart the CasaOS Gateway service +systemctl restart casaos-gateway.service + +echo "Port changed and CasaOS Gateway service restarted successfully."