diff options
-rwxr-xr-x | tcwg-cleanup-stale-containers.sh | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/tcwg-cleanup-stale-containers.sh b/tcwg-cleanup-stale-containers.sh index cc748c5c..df723dba 100755 --- a/tcwg-cleanup-stale-containers.sh +++ b/tcwg-cleanup-stale-containers.sh @@ -200,9 +200,24 @@ fi if [ "$cleanup_ssh_agent_hours" -gt "0" ]; then res=0; killall --older-than ${cleanup_ssh_agent_hours}h -u $USER ssh-agent & wait $! || res=$? + # Killall can fail for several reasons: + # return-code 127: command not found + # return-code 1: in general means no ssh-agent process was found + # In the first case, we want the cleanup job to fail, so that we + # know we need to install killall + # The second case is OK, unless killall fails for another + # reason. Assume OK for now. if [ $res != 0 ]; then - echo "WARNING: could not kill stale ssh-agent processes" - status=$(($status|16)) + case $res in + 127) + echo "WARNING: could not kill stale ssh-agent processes (killall command not found)" + echo "Increasing exit code to indicate killall is missing" + status=$(($status|16)) + ;; + 1) + echo "WARNING: could not kill stale ssh-agent processes" + ;; + esac fi fi |