diff --git a/backup.sh b/backup.sh index f8fee2ec1eff8664058d113a3763ddcf75634e54..dc7da6e9cf80ea2d7c03e3bccf9a91f65ea2e0a1 100755 --- a/backup.sh +++ b/backup.sh @@ -40,7 +40,6 @@ function backup { NARG_NAME=$1 NARG_FILE=$2 shift 2 - echo $MYSQLDUMP_CMD # parameters: connection, database, outfile if [ -e "$NARG_FILE" ]; then failure "dumpfile already exists." diff --git a/log.py b/log.py index d347c9dbc27a7f425c1a44b37629a51b699f1416..d8d6b9f3bf10662c16e8e390746a30ed2343f282 100755 --- a/log.py +++ b/log.py @@ -31,28 +31,6 @@ SQL_BASE = ["mysql", "--batch", "--user=caosdb", "--password=random1234", "--host=sqldb", "--port=3306"] -test_yaml = """ -action: log -log_action: storeoff -""" - - -def exec(args): - "Executing the logging action action." - action = args["log_action"] - - result = None - - if action.startswith("store"): - result = {"tsv_content": _store_log()} - - if action.endswith("on"): - _logging(True) - elif action.endswith("off"): - _logging(False) - - return result - def _store_log(): """Retrieves the log table and returns it as a TSV string. diff --git a/log.sh b/log.sh new file mode 100755 index 0000000000000000000000000000000000000000..1b4cf35ef3a422f492133f1ce276ebd1dd066d21 --- /dev/null +++ b/log.sh @@ -0,0 +1,43 @@ +#!/bin/bash +# +# ** header v3.0 +# This file is a part of the CaosDB Project. +# +# Copyright (C) 2018 Research Group Biomedical Physics, +# Max-Planck-Institute for Dynamics and Self-Organization Göttingen +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <https://www.gnu.org/licenses/>. +# +# ** end header +# + +#start and stop logging; get current logs + +. .config +# load useful stuff - scans the parameters and so on... +. patches/utils/patch_header.sh + +function set_logging { + echo "Setting logging $1..." + echo "SET GLOBAL log_output = 'TABLE'; SET GLOBAL general_log = '$1';" | \ + $MYSQL_CMD $MYSQL_CONNECTION --batch + success +} + +case $1 in + "start") set_logging "on" ;; + "stop") set_logging "off" ;; + "get") get_logs ;; + *) echo "Unknown argument: $1"; exit 1 +esac