summaryrefslogtreecommitdiff
path: root/tcwg-cleanup-stale-containers.sh
diff options
context:
space:
mode:
authorChristophe Lyon <christophe.lyon@linaro.org>2019-03-04 10:28:48 +0000
committerChristophe Lyon <christophe.lyon@linaro.org>2019-03-04 10:28:48 +0000
commit2913f9f0aa2f3827f90c972eada22781c90fda7e (patch)
treef703cea173890c14475feb46b9cec3bdc1743b1e /tcwg-cleanup-stale-containers.sh
parentf64d30e3f08e7d731f6b37ccade481b9db2a1138 (diff)
tcwg-cleanup-stale-containers.sh: Report failure to kill stale ssh-agent processes.
Without this patch, failure to kill such processes is not reported as part of the script exit status. This happens for instance when the killall command is not installed on the machine. Change-Id: Ic0fa10ce6b69f12fb2382cfa3680fcc1c7d1b4bd
Diffstat (limited to 'tcwg-cleanup-stale-containers.sh')
-rwxr-xr-xtcwg-cleanup-stale-containers.sh6
1 files changed, 5 insertions, 1 deletions
diff --git a/tcwg-cleanup-stale-containers.sh b/tcwg-cleanup-stale-containers.sh
index 0dd642f7..cc748c5c 100755
--- a/tcwg-cleanup-stale-containers.sh
+++ b/tcwg-cleanup-stale-containers.sh
@@ -200,6 +200,10 @@ 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=$?
+ if [ $res != 0 ]; then
+ echo "WARNING: could not kill stale ssh-agent processes"
+ status=$(($status|16))
+ fi
fi
# Check if we have more containers than max_containers
@@ -207,7 +211,7 @@ nb_containers=$($DOCKER ps -a | wc -l)
if [ ${max_containers} -gt 0 -a ${nb_containers} -gt ${max_containers} ]; then
echo "ERROR: Too many containers left after cleanup: ${nb_containers} (max: ${max_containers})"
- status=$(($status|16))
+ status=$(($status|32))
fi
exit $status