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
这里循环永远不会退出,它会继续打印“自动化正在运行......”即使在自动化已经执行并且状态没有进行中我想要做的是等到状态为“进行中”,打印“自动化是正在运行……”在屏幕上。完成后,如果失败或成功,我想在屏幕上打印自动化状态。