diff options
author | Riku Voipio <riku.voipio@linaro.org> | 2019-02-25 09:42:03 +0200 |
---|---|---|
committer | Riku Voipio <riku.voipio@linaro.org> | 2019-02-25 20:53:32 +0000 |
commit | 412ac0d1c3c178656831eacad66a5a2111e7788b (patch) | |
tree | e20c11ac328dff67c3de989b6de2ac06d0cd2958 /ci-ssh-cleanup.yaml | |
parent | 86a7d0a486a0e622ac9c3fb7b50f3b4462bdfecd (diff) |
ci-ssh-cleanup: dont error if nothing to kill
Previouslt we failed if no ssh-agent jobs older than 4 days
were listed with ps.
Separate the kill and ps listing lines, so we can check if
there is anything to kill
Change-Id: Id645689d74626c546446894d1dc37f8d39d4c9b8
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
Diffstat (limited to 'ci-ssh-cleanup.yaml')
-rw-r--r-- | ci-ssh-cleanup.yaml | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/ci-ssh-cleanup.yaml b/ci-ssh-cleanup.yaml index f25f163b..0d3b1678 100644 --- a/ci-ssh-cleanup.yaml +++ b/ci-ssh-cleanup.yaml @@ -16,7 +16,8 @@ builders: - shell: | #!/bin/bash -e - kill $(ps -eo pid,etime,comm,user,tty|grep ssh-agent |awk '$2~/-/ {if ($2>4) print $1}') + pids=$(ps -eo pid,etime,comm,user,tty|grep ssh-agent |awk '$2~/-/ {if ($2>4) print $1}') + [ -z "$pids" ] || kill $pids publishers: - email: recipients: 'linaro-infrastructure-errors@lists.linaro.org' |