blob: 0b72935fca5fc883679076238da9d26925f79eb7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
#!/bin/sh
# periodically connects to the buildmaster to call ping-from-slave to:
# - report any update on the build process
# - show that the build is still running
# - get notified by the build master if the build is not necessary anymore
# shellcheck disable=SC2119,SC2120
# shellcheck source=../lib/load-configuration
. "${0%/*}/../lib/load-configuration"
# TODO: abort build if requested to
parent_pid="$1"
parent_tmp_dir="$2"
exec 9> "${work_dir}/ping-build-master.lock"
while kill -0 "${parent_pid}" && \
[ -f "${parent_tmp_dir}/.ping-build-master" ]; do
# shellcheck disable=SC2029
find "${parent_tmp_dir}" \
-xdev \
-type f \
-name '*.build-log' \
-exec wc -l {} \; | \
sed 's, .*/, ,' | \
ssh -o PasswordAuthentication=No \
-i "${master_build_server_identity}" \
-p "${master_build_server_port}" \
"${master_build_server_user}@${master_build_server}" \
'ping-from-slave' "$(cat "${parent_tmp_dir}/.ping-build-master")" || \
true
# we wait upto 60 seconds to get the lock - if we get it, the parent
# must have released it and we're finished
if flock -w 60 9; then
break
fi
done
|