Files
big-bear-scripts-bigbeartec…/change-casaos-web-ui-port/run.sh
Christopher 222e6af258 🔧 refactor: Use #!/usr/bin/env bash in all shell scripts (#16)
This commit refactors all the shell scripts to use `#!/usr/bin/env bash` instead of `#!/bin/bash`. This change ensures that the scripts will run with the system's default Bash interpreter, even if it is not located at the standard `/bin/bash` path.
2024-10-23 13:32:15 -05:00

22 lines
630 B
Bash

#!/usr/bin/env 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.ini /etc/casaos/gateway.ini.bak
# Change the port number in the configuration file
sed -i "s/^port=[0-9]\+/port=$new_port/" /etc/casaos/gateway.ini
# Restart the CasaOS Gateway service
systemctl restart casaos-gateway.service
echo "Port changed and CasaOS Gateway service restarted successfully."