until [ $(aws ssm get-automation-execution --automation-execution-id "$id" --query 'AutomationExecution.AutomationExecutionStatus' --output text) = *"InProgress"* ];
do
echo "Automation is running......"
sleep 1m
done
status=$(aws ssm get-automation-execution --automation-execution-id "$id" --query 'AutomationExecution.AutomationExecutionStatus' --output text)
if [ "$status" == "Success" ]; then
echo "Automation $status"
elif [ "$status" == "Failed" -o "$status" == "Cancelled" -o "$status" == "Timed Out" ]; then
echo "Automation $status"
fi
ここでループは決して終了せず、自動化が実行され、ステータスが進行していない後でも「自動化が実行中です...」と出力し続けます。ステータスが「進行中」になるまで待機し、「自動化が進行中です」実行中……」という画面。終了したら、失敗または成功した場合に自動化のステータスを画面に出力したいと思います。