#!/bin/bash

[ -e /mnt/replaced-instance-controller ] && exit 0
sudo find /usr/share/aws/emr/instance-controller/lib -name 'instance-controller*.jar' -and -not -name '*interface*' -exec rm {} \;
sudo aws s3 cp s3://ty-emr/XRR/bootstrap/instance-controller/instance-controller-1.26.0.jar /usr/share/aws/emr/instance-controller/lib/
chmod +x /usr/share/aws/emr/instance-controller/lib/instance-*
touch /mnt/replaced-instance-controller
sudo service instance-controller stop
sudo service logpusher stop
