Deal with multiple hosts entries in scripts/stop.sh
Created by: michielbdejong
After my scripts/start.sh run failed (because it could not write to /tmp/server.config), my scripts/stop.sh run then also failed because there are two backup.test and two server.test entries in my /etc/hosts. It then cannot determine which SUBID to kill. So the line curl -d SUBID=$SUBID https://api.vultr.com/v1/server/destroy\?api_key\=$VULTR_API_KEY
will be executed as:
curl -d SUBID=12345 12346 https://api.vultr.com/v1/server/destroy\?api_key\=abcd
and then curl errors with 'Could not connect to server' because it tries to connect to '12346'
Maybe the grep or the sed step can make sure it never return more than 1 version, or you can add another cut
step, to make sure only the first number is passed on if there is a space.
Same goes for some parts of the start.sh script, as discussed before