Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有时,诸如apt-get update -qcloudformation 模板用户数据脚本中的命令会随机失败。重试它们直到成功的正确方法是什么?
apt-get update -q
正如@shellter 指出的那样:
while ! apt-get update -q ; do sleep 1; done
或者,对于脚本:
while ! apt-get update -q do echo "Failed. Trying again..." >&2 sleep 1 done