libresh / libre.sh

Moved to https://lab.libreho.st/libre.sh/compose.libre.sh
GNU Affero General Public License v3.0
189 stars 22 forks source link

Deal with multiple hosts entries in scripts/stop.sh #50

Closed michielbdejong closed 9 years ago

michielbdejong commented 9 years ago

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