From e79899070df2fcbc7903a314510b41868e635b9d Mon Sep 17 00:00:00 2001 From: Dmitry Ozerov Date: Wed, 20 May 2020 11:11:10 +0200 Subject: [PATCH] check that there is no other sf_replay/writer instances running already --- scripts/retrieve_detector_data.sh | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/scripts/retrieve_detector_data.sh b/scripts/retrieve_detector_data.sh index c655cf4..705fd59 100755 --- a/scripts/retrieve_detector_data.sh +++ b/scripts/retrieve_detector_data.sh @@ -30,10 +30,26 @@ coreAssociated_replay=(7 7 7 7 8 8 8 8 9 9 9 9 10 10 10 10 11 11 11 11 12 12 12 coreAssociated_writer="2,3,4,5,6" -touch /tmp/detector_retrieve.log +touch /tmp/detector_retrieve.log /tmp/detector_retrieve_replay.log cd /gpfs/photonics/swissfel/buffer/ +PREVIOUS_STILL_RUN=1 +while [ ${PREVIOUS_STILL_RUN} = 1 ] +do + PREVIOUS_STILL_RUN=0 + ps -fe | grep "/usr/bin/sf_replay " | grep -v grep | grep sf_ > /dev/null + PREVIOUS_STILL_RUN1=$? + ps -fe | grep "/usr/bin/sf_writer " | grep -v grep | grep sf_ > /dev/null + PREVIOUS_STILL_RUN2=$? + if [ ${PREVIOUS_STILL_RUN1} != 1 -o ${PREVIOUS_STILL_RUN2} != 1 ] + then + PREVIOUS_STILL_RUN=1 + echo "Previous retrieve is not yet finished ${PREVIOUS_STILL_RUN1} ${PREVIOUS_STILL_RUN2}" + sleep 30 + fi +done + for M in {00..31} do taskset -c ${coreAssociated_replay[10#${M}]} /usr/bin/sf_replay ${DETECTOR} M${M} ${M} ${START_PULSE_ID} ${STOP_PULSE_ID} >> /tmp/detector_retrieve_replay.log &