Open csiess opened 6 years ago
Hi,
thanks a lot for this great script. I had a small issue:
START_ALIAS_LINUX="10.2.237.1"; END_ALIAS_LINUX="10.2.237.49"
This stopped the script working beyond IP 10.2.237.10 because: last_ip_used outputs 10.2.237.9 where it should output 10.2.237.10:
docker inspect --format '{{ .HostConfig }}' $(docker ps -aq)| grep -o '[0-9]+[.][0-9]+[.][0-9]+[.][0-9]+ 8000'|cut -d" " -f 1|sort -u|tail -1 10.2.237.9
docker inspect --format '{{ .HostConfig }}' $(docker ps -aq)| grep -o '[0-9]+[.][0-9]+[.][0-9]+[.][0-9]+ 8000'|cut -d" " -f 1|sort -u 10.2.237.10 10.2.237.2 10.2.237.3 10.2.237.4 10.2.237.5 10.2.237.6 10.2.237.7 10.2.237.8 10.2.237.9
Adding the -n switch to the sort command fixes this:
docker inspect --format '{{ .HostConfig }}' $(docker ps -aq)| grep -o '[0-9]+[.][0-9]+[.][0-9]+[.][0-9]+ 8000'|cut -d" " -f 1|sort -un|tail -1 10.2.237.10
Hi,
thanks a lot for this great script. I had a small issue:
START_ALIAS_LINUX="10.2.237.1"; END_ALIAS_LINUX="10.2.237.49"
This stopped the script working beyond IP 10.2.237.10 because: last_ip_used outputs 10.2.237.9 where it should output 10.2.237.10:
docker inspect --format '{{ .HostConfig }}' $(docker ps -aq)| grep -o '[0-9]+[.][0-9]+[.][0-9]+[.][0-9]+ 8000'|cut -d" " -f 1|sort -u|tail -1 10.2.237.9
docker inspect --format '{{ .HostConfig }}' $(docker ps -aq)| grep -o '[0-9]+[.][0-9]+[.][0-9]+[.][0-9]+ 8000'|cut -d" " -f 1|sort -u 10.2.237.10 10.2.237.2 10.2.237.3 10.2.237.4 10.2.237.5 10.2.237.6 10.2.237.7 10.2.237.8 10.2.237.9
Adding the -n switch to the sort command fixes this:
docker inspect --format '{{ .HostConfig }}' $(docker ps -aq)| grep -o '[0-9]+[.][0-9]+[.][0-9]+[.][0-9]+ 8000'|cut -d" " -f 1|sort -un|tail -1 10.2.237.10