diff --git a/.gitattributes b/.gitattributes index 7302a9e255092d96ef7eb3ef3b60e2ee99a505f5..8758b67450e2f0fa747d7287d94d5304ad6534f2 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 dbf177093bd9a06aff2c7e402d92a2a4fc483c80..16fe70ab76e9a3c9a8f09d4b91a2f55f52cb6a17 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 373833afa50ecc2c91df4ccb18efc7d43cd59103..1a558a06e510368631b91652965ce2a9d795a310 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 0000000000000000000000000000000000000000..126e21162250c9c0e6f06975e66bd53870469c03 --- /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