diff options
author | Erich Eckner <git@eckner.net> | 2018-03-27 11:11:19 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2018-03-27 11:11:19 +0200 |
commit | f93129610095544c671e6f65541011fe1ba4e498 (patch) | |
tree | 30228eba76db5d28538d6423a779f9f22fbd7764 /bin/ping-from-slave | |
parent | bac85d5b0eae27f56fe5206d8342ef47983dcbb6 (diff) | |
download | builder-f93129610095544c671e6f65541011fe1ba4e498.tar.xz |
bin/ping-from-slave: save count of logged lines in database
Diffstat (limited to 'bin/ping-from-slave')
-rwxr-xr-x | bin/ping-from-slave | 28 |
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 |