Add change casaos web ui port

This commit is contained in:
Christopher
2023-09-23 21:15:32 -05:00
parent 115989a72d
commit 7232d3202f
2 changed files with 26 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/change-casaos-web-ui-port/run.sh)"
```

View File

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