From 3edeeb61fed2a7adcd8766818cdbae90b27d9fe6 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Mon, 2 Apr 2018 22:03:54 +0200 Subject: bin/ping-from-slave: save build_slaves.last_action --- bin/ping-from-slave | 39 ++++++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 15 deletions(-) (limited to 'bin/ping-from-slave') diff --git a/bin/ping-from-slave b/bin/ping-from-slave index 80ec46a..3c03b45 100755 --- a/bin/ping-from-slave +++ b/bin/ping-from-slave @@ -26,12 +26,20 @@ 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")' \ +# shellcheck disable=SC2016 +{ + printf 'UPDATE `build_slaves`' + printf ' SET' + printf ' `build_slaves`.`last_action`=from_base64("%s")' \ + "$( + printf '%s' "$1" | \ + base64 -w0 + )" + + printf ', `build_slaves`.`logged_lines`=' + if [ -n "${log_lines}" ]; then + printf 'from_base64("%s")' \ "$( printf '%s' "$(( $( @@ -41,13 +49,14 @@ if [ -n "${log_lines}" ]; then )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 'unimportant' - -fi + else + printf 'NULL' + fi + + printf ' WHERE `build_slaves`.`name`=from_base64("%s");\n' \ + "$( + printf '%s' "${slave}" | \ + base64 -w0 + )" +} | \ + mysql_run_query 'unimportant' -- cgit v1.2.3-70-g09d2