summaryrefslogtreecommitdiffstats
path: root/roles/copr/backend/files/instant-instance-killer.sh
blob: da4fbade42d5b6cc9c91b3dd62675c88e60fc16b (plain)
1
2
3
4
5
6
7
8
9
10
11
#!/usr/bin/env bash

source /home/copr/cloud/ec2rc.sh

/bin/euca-describe-instances | grep INSTANCE | while read line; do
    id="$(echo $line | cut -d' ' -f2)"
    state="$(echo $line | cut -d' ' -f6)"
    if [[ "$state" == "error" ]]; then
        /bin/euca-terminate-instances "$id"
    fi
done