correct the sed command while set the hostname

pull/801/head
leet 2024-08-03 22:18:30 +08:00
parent a9cb5f7ba5
commit daa3f6a629
1 changed files with 1 additions and 1 deletions

View File

@ -105,7 +105,7 @@ Set the hostname on each machine listed in the `machines.txt` file:
```bash ```bash
while read IP FQDN HOST SUBNET; do while read IP FQDN HOST SUBNET; do
CMD="sed -i 's/^127.0.1.1.*/127.0.1.1\t${FQDN} ${HOST}/' /etc/hosts" CMD="sed -i 's/^127.0.0.1.*/127.0.0.1\t${FQDN} ${HOST}/' /etc/hosts"
ssh -n root@${IP} "$CMD" ssh -n root@${IP} "$CMD"
ssh -n root@${IP} hostnamectl hostname ${HOST} ssh -n root@${IP} hostnamectl hostname ${HOST}
done < machines.txt done < machines.txt