From 17132585bccfd9344b36ff4e53e3b0d18a2345b7 Mon Sep 17 00:00:00 2001 From: Jan David Mol <mol@astron.nl> Date: Fri, 17 Jan 2014 08:34:18 +0000 Subject: [PATCH] Task #5385: Added swlevel support for Cobalt (called 'CobaltControl') --- .gitattributes | 1 + MAC/APL/APLCommon/src/swlevel.conf | 1 + RTCP/Cobalt/GPUProc/src/CMakeLists.txt | 1 + .../GPUProc/src/scripts/CobaltControl.sh | 51 +++++++++++++++++++ 4 files changed, 54 insertions(+) create mode 100755 RTCP/Cobalt/GPUProc/src/scripts/CobaltControl.sh diff --git a/.gitattributes b/.gitattributes index 7302a9e2550..8758b67450e 100644 --- a/.gitattributes +++ b/.gitattributes @@ -3850,6 +3850,7 @@ RTCP/Cobalt/GPUProc/src/SysInfoLogger.h -text RTCP/Cobalt/GPUProc/src/backward/CL/cl.hpp -text RTCP/Cobalt/GPUProc/src/cpu_utils.cc -text RTCP/Cobalt/GPUProc/src/cpu_utils.h -text +RTCP/Cobalt/GPUProc/src/scripts/CobaltControl.sh eol=lf RTCP/Cobalt/GPUProc/src/scripts/apply_casacore_measures_data.sh eol=lf RTCP/Cobalt/GPUProc/src/scripts/get_casacore_measures_data.sh eol=lf RTCP/Cobalt/GPUProc/src/scripts/runObservation.sh -text diff --git a/MAC/APL/APLCommon/src/swlevel.conf b/MAC/APL/APLCommon/src/swlevel.conf index dbf177093bd..16fe70ab76e 100644 --- a/MAC/APL/APLCommon/src/swlevel.conf +++ b/MAC/APL/APLCommon/src/swlevel.conf @@ -37,4 +37,5 @@ 6::d:::BeamControl 6::d:::TBBControl 6::d:::PythonControl +6::d:::CobaltControl # diff --git a/RTCP/Cobalt/GPUProc/src/CMakeLists.txt b/RTCP/Cobalt/GPUProc/src/CMakeLists.txt index 373833afa50..1a558a06e51 100644 --- a/RTCP/Cobalt/GPUProc/src/CMakeLists.txt +++ b/RTCP/Cobalt/GPUProc/src/CMakeLists.txt @@ -118,6 +118,7 @@ lofar_add_bin_program(station_stream Station/station_stream.cc) # install the scripts for MAC and for auto-updating casacore measures tables install(PROGRAMS + scripts/CobaltControl.sh scripts/runObservation.sh scripts/startBGL.sh scripts/stopBGL.sh diff --git a/RTCP/Cobalt/GPUProc/src/scripts/CobaltControl.sh b/RTCP/Cobalt/GPUProc/src/scripts/CobaltControl.sh new file mode 100755 index 00000000000..126e2116225 --- /dev/null +++ b/RTCP/Cobalt/GPUProc/src/scripts/CobaltControl.sh @@ -0,0 +1,51 @@ +#!/bin/bash +# +# CobaltControl.sh is the interface for `swlevel' to see +# which observations are running, and to kill them if requested. + +COMMAND=$1 + +function procname() { + # the basename of this script, without its extension + basename -- "$0" | sed 's/[.][^.]*$//g' +} + +shopt -s nullglob + +case $COMMAND in + start) + # no-op + ;; + + stop) + for PIDFILE in $LOFARROOT/var/run/*.pid + do + PID=`cat $PIDFILE` + echo "Softly killing rtcp(${PID})" + kill -15 $PID + done + ;; + + status) + SWLEVEL=$2 + + PIDS="" + OBSIDS="" + for PIDFILE in $LOFARROOT/var/run/*.pid + do + PIDS="$PIDS `cat $PIDFILE`" + OBSIDS="$OBSIDS `echo $PIDFILE | perl -ne '/rtcp-([0-9]+).pid/; print $1;'`" + done + + if [ -z "$OBSIDS" ] + then + printf "%d : %-25s DOWN\n" "$SWLEVEL" "`procname`" + else + printf "%d : %-25s %s %s\n" "$SWLEVEL" "`procname`" "$PIDS" "[ObsID:$OBSIDS]" + fi + ;; + + *) + echo "usage: $0 {start|stop|status}" + ;; +esac -- GitLab