diff options
author | Maxim Kuvyrkov <maxim.kuvyrkov@linaro.org> | 2020-12-19 20:03:19 +0000 |
---|---|---|
committer | Maxim Kuvyrkov <maxim.kuvyrkov@linaro.org> | 2020-12-19 20:03:19 +0000 |
commit | 4d2b2b5d77ef838b514f28e8a38a9ee629ecf2ff (patch) | |
tree | e5a5dd0d51a19001e0101ef9c8b0d5e2e4bcc01c | |
parent | c2a83d2bfc7a35fcef7c1257ced8259ac8d20d29 (diff) |
tcwg-start-container.sh: Make more robust
Change-Id: I49f6044d75396357347f6a09e6345b6a54f7f523
-rwxr-xr-x | tcwg-start-container.sh | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/tcwg-start-container.sh b/tcwg-start-container.sh index 5917e834..5c227871 100755 --- a/tcwg-start-container.sh +++ b/tcwg-start-container.sh @@ -33,7 +33,9 @@ if docker stats --no-stream "$container" >/dev/null 2>&1; then ;; esac # Rename the current container to free-up the name for "docker run" below. - rm_cnt="$container.bak" + # Use rename name starting with a number (seconds since epoch) so that + # it'll be cleaned up even if something goes wrong here. + rm_cnt="$(date +%Y-%m-%d)-$container.bak" docker rename "$container" "$rm_cnt" & res=0 && wait $! || res=$? if [ x"$res" != x"0" ]; then |