From f93129610095544c671e6f65541011fe1ba4e498 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Tue, 27 Mar 2018 11:11:19 +0200 Subject: bin/ping-from-slave: save count of logged lines in database --- bin/ping-from-slave | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) 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 -- cgit v1.2.3-70-g09d2