#!/bin/bash

DNS_NAME=$(ec2metadata --public-hostname)

echo "=============================="
echo $1
echo $2
echo $3

echo "Removing server $1 from LoadBalancer: $DNS_NAME"
sed -i "/$1/d" /etc/nginx/sites-available/$DNS_NAME
sudo service nginx reload