There are containers
CTID NPROC STATUS IP_ADDR HOSTNAME
101 19 running 127.0.0.2 test1
102 19 running 127.0.0.3 test2
You need to assign a hostname .= the ip of the container
You can make your hands in the form :
vzctl set 101 --hostname "127.0.0.2" --save
Choose the required field is id and ip, but this is the line, how to separate while loop?
I probably do not say so
you can choose a -o ctid,ip
the point is how to use them in a loop for each of the next id to assign his ip to hostname
``
for CT in $(vzlist -H -o ctid); do echo "== CT $CT =="; vzctl exec $CT uptime; done
``
Only use id, and need id + ip - jana95 commented on March 19th 20 at 08:41
IFS
andread
.https://bash.cyberciti.biz/guide/$IFS
tldp.org/LDP/Bash-Beginners-Guide/html/sect_08_02.html - Jaleel_Glover29 commented on March 19th 20 at 08:44