From 31b7c36ddd7929aaa1d075a9413f9296d4b1a0b9 Mon Sep 17 00:00:00 2001 From: Vitor Trovisco <vmt25@cam.ac.uk> Date: Tue, 24 Nov 2020 12:44:08 +0000 Subject: [PATCH] Add new file - canto_running_log.sh This script prints all the activity log from the running canto-server container into the file 'canto_running.log' in the 'logs' sub-folder of 'canto-space' --- canto_running_log.sh | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 canto_running_log.sh diff --git a/canto_running_log.sh b/canto_running_log.sh new file mode 100644 index 0000000..bb2d5fb --- /dev/null +++ b/canto_running_log.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +#this script prints all the activity log messages from the running canto-server container into the file 'canto_running.log' in the 'logs' sub-folder of 'canto-space' + +# Define canto-space root +CANTOSPACE="/data/export/canto-space" + +# Define logs folder inside canto-space +LOGS="logs" + +# Define log file +LOGFILE="${CANTOSPACE}/${LOGS}/canto_server_running.log" + +#this line retrieves the canto container id +DOCKERNAME=$(docker ps -a --filter status=running | awk '$2 ~ /pombase\/canto-run/ { print $1 }') + + if [[ ! -z "${DOCKERNAME}" ]]; then + echo "Canto running on container ${DOCKERNAME} - see canto_server_running.log for the log messages" + + # Redirect all output to logfile + exec &> "${LOGFILE}" + + #docker logs is docker's command to retrieve all log messages from a specific container + docker logs "${DOCKERNAME}" + + else echo "Canto not running - no log messages to show" + + fi + +exit \ No newline at end of file -- GitLab