mirror of
https://github.com/bigbeartechworld/big-bear-scripts.git
synced 2026-03-31 06:33:56 -04:00
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.
22 lines
630 B
Bash
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."
|