Skip to content
Snippets Groups Projects
Commit d64dc6db authored by Henrik tom Wörden's avatar Henrik tom Wörden
Browse files

MAINT: trying to reuse existing code

parent 3a51a628
No related branches found
No related tags found
No related merge requests found
......@@ -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."
......
......@@ -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.
......
log.sh 0 → 100755
#!/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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment