From c5ebb90c9d01b77a623c5e6d66b208d6fd72d0de Mon Sep 17 00:00:00 2001 From: Arno Schoenmakers <schoenmakers@astron.nl> Date: Fri, 12 Jan 2018 08:16:06 +0000 Subject: [PATCH] TAsk #11540: Changed swlevel, TBB scripts to enable usage through remote ssh call --- MAC/APL/APLCommon/src/swlevel | 14 +++++++------- MAC/APL/StationCU/src/TBBControl/startTBB.sh | 5 +++++ MAC/APL/StationCU/src/TBBControl/stopTBB.sh | 5 +++++ 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/MAC/APL/APLCommon/src/swlevel b/MAC/APL/APLCommon/src/swlevel index 3906adf6881..d70e8c5bf73 100755 --- a/MAC/APL/APLCommon/src/swlevel +++ b/MAC/APL/APLCommon/src/swlevel @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash # # swlevel : bring software on node in certain runlevel # @@ -25,9 +25,9 @@ # $Id$ # -if [ "$LOFARROOT" == "" ]; then +if [ -z $LOFARROOT ]; then # default value until all MAC controlled systems provide $LOFARROOT - LOFARROOT=/opt/lofar + export LOFARROOT=/opt/lofar fi BINDIR=$LOFARROOT/bin @@ -150,7 +150,7 @@ selectImage() #if [ "$boardHex" == "03" ]; then # boardHex="1F" #fi - ethport=`grep RSPDriver.IF_NAME /opt/lofar/etc/RSPDriver.conf | awk -F= '{print $2}'` + ethport=`grep RSPDriver.IF_NAME ${ETCDIR}/RSPDriver.conf | awk -F= '{print $2}'` rsu=`timeout 5 sudo ${SBINDIR}/rsuctl3 -i ${ethport} -m 10:fa:00:00:$boardHex:00 -qV 2>&1 | grep BP | cut -d':' -f2 | sed 's/ //g' | cut -d'.' -f1` # If not a single number, something weird must have happened @@ -192,8 +192,8 @@ if [ -e $BINDIR/rspctl ]; then timeout=10 for (( s=0 ; s<timeout; s++ )) do - rsp_ready_1=`( timeout 2 rspctl --version | grep "0.0" ) >& /dev/null; echo $?` - rsp_ready_2=`( timeout 2 rspctl --status | grep "PCB" ) >& /dev/null; echo $?` + rsp_ready_1=`( timeout 2 $BINDIR/rspctl --version | grep "0.0" ) >& /dev/null; echo $?` + rsp_ready_2=`( timeout 2 $BINDIR/rspctl --status | grep "PCB" ) >& /dev/null; echo $?` if [ $rsp_ready_1 == 1 -a $rsp_ready_2 == 1 ]; then echo "RSPDriver died; quitting now" @@ -219,7 +219,7 @@ if [ -e $BINDIR/tbbctl ]; then sleep 10 for (( s=0 ; s<timeout; s++ )) do - tbb_respons=`timeout 2 tbbctl --version` + tbb_respons=`timeout 2 $BINDIR/tbbctl --version` tbb_ready=`( echo $tbb_respons | grep "\ V\ " ) >& /dev/null; echo $?` if [ $tbb_ready -eq 0 ]; then sleep 10 # additional delay to let TBB boards end their init phase diff --git a/MAC/APL/StationCU/src/TBBControl/startTBB.sh b/MAC/APL/StationCU/src/TBBControl/startTBB.sh index 155f6bc383a..34cfa2ccba0 100755 --- a/MAC/APL/StationCU/src/TBBControl/startTBB.sh +++ b/MAC/APL/StationCU/src/TBBControl/startTBB.sh @@ -6,6 +6,11 @@ # $Id:$ # +# Only in ILT mode when lofarsys controls the system +if [ "$USER" != "lofarsys" ]; then + exit +fi + level=`swlevel -S` if [ $level -lt 2 ]; then echo "Swlevel must be 2 or higher, and RSPDriver and TBBDriver must be running" diff --git a/MAC/APL/StationCU/src/TBBControl/stopTBB.sh b/MAC/APL/StationCU/src/TBBControl/stopTBB.sh index cc1f3997120..3a8de4da166 100755 --- a/MAC/APL/StationCU/src/TBBControl/stopTBB.sh +++ b/MAC/APL/StationCU/src/TBBControl/stopTBB.sh @@ -6,6 +6,11 @@ # $Id:$ # +# Only in ILT mode when lofarsys controls the system +if [ "$USER" != "lofarsys" ]; then + exit +fi + level=`swlevel -S` if [ $level -lt 2 ]; then echo "Swlevel must be 2 or higher, and RSPDriver and TBBDriver must be running" -- GitLab