#!/bin/bash

set -x

echo "Closing location, " `date`

rm -f stopped_list ;
cat instances_list | while read host port ; do 
    echo "$host $port" | tee -a stopped_list ;
    curl -s "http://$host:$((port+3))/?command=disable_search" | jq . ;
    sleep 10 ;
done

echo "Location closed, " `date`
