diff options
author | Erich Eckner <git@eckner.net> | 2018-04-17 14:36:01 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2018-04-17 14:36:01 +0200 |
commit | 43fa3509c4d5f36692589512d1b4771c8f8d8cf7 (patch) | |
tree | 8ed0f2810df3d326c0e7d7cca0cc6135098cc3a7 | |
parent | 09e4e9d45db1f445d916f17c6296eabf65485ed9 (diff) | |
download | builder-43fa3509c4d5f36692589512d1b4771c8f8d8cf7.tar.xz |
bin/slave-build-connect: write ssh-log into database
-rwxr-xr-x | bin/slave-build-connect | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/bin/slave-build-connect b/bin/slave-build-connect index 7c6dedc..8e9dbcf 100755 --- a/bin/slave-build-connect +++ b/bin/slave-build-connect @@ -16,14 +16,28 @@ if [ "x${SSH_ORIGINAL_COMMAND%% *}" = 'xget-assignment' ] || \ fi - printf '%s %s %s\n' "$(date '+%F %T')" "$1" "${SSH_ORIGINAL_COMMAND}" >> \ - "${work_dir}/ssh-log" - # shellcheck disable=SC2016 { + printf 'INSERT INTO `ssh_log` (`date`,`build_slave`,`action`,`parameters`)' + printf ' SELECT NOW(),`build_slaves`.`id`' + printf ',from_base64("%s")' \ + "$( + print '%s' "${SSH_ORIGINAL_COMMAND%% *}" | \ + base64 -w0 + )" \ + "$( + print '%s' "${#* }" | \ + base64 -w0 + )" + printf ' FROM `build_slaves`' + printf ' WHERE `build_slaves`.`name`=from_base64("%s");\n' \ + "$( + printf '%s' "$1" | \ + base64 -w0 + )" printf 'UPDATE `build_slaves`' printf ' SET `build_slaves`.`last_connection`=NOW()' - printf ' WHERE `build_slaves`.`name`=from_base64("%s")\n' \ + printf ' WHERE `build_slaves`.`name`=from_base64("%s");\n' \ "$( printf '%s' "$1" | \ base64 -w0 |