Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/bin/ping-from-slave
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-03-27 11:11:19 +0200
committerErich Eckner <git@eckner.net>2018-03-27 11:11:19 +0200
commitf93129610095544c671e6f65541011fe1ba4e498 (patch)
tree30228eba76db5d28538d6423a779f9f22fbd7764 /bin/ping-from-slave
parentbac85d5b0eae27f56fe5206d8342ef47983dcbb6 (diff)
bin/ping-from-slave: save count of logged lines in database
Diffstat (limited to 'bin/ping-from-slave')
-rwxr-xr-xbin/ping-from-slave28
1 files changed, 28 insertions, 0 deletions
diff --git a/bin/ping-from-slave b/bin/ping-from-slave
index 92bee57..e163649 100755
--- a/bin/ping-from-slave
+++ b/bin/ping-from-slave
@@ -23,3 +23,31 @@ if [ "$(
>&2 echo 'You do not build anything currently - abort whatever you are doing.'
exit 2
fi
+
+log_lines=$(cat)
+
+if [ -n "${log_lines}" ]; then
+
+ # shellcheck disable=SC2016
+ {
+ printf 'UPDATE `build_slaves`'
+ printf ' SET `build_slaves`.`logged_lines`=from_base64("%s")' \
+ "$(
+ printf '%s' "$((
+ $(
+ printf '%s' "${log_lines}" | \
+ cut -d' ' -f1 | \
+ tr '\n' '+'
+ )0))" | \
+ base64 -w0
+ )"
+ printf ' WHERE `build_slaves`.`name`=from_base64("%s");\n' \
+ "$(
+ printf '%s' "${slave}" | \
+ base64 -w0
+ )"
+ } | \
+ tee /tmp/ping-from-slave.query | \
+ mysql_run_query
+
+fi