我创建了一个zsh
脚本,以分离模式启动许多具有特定名称的屏幕,并在其中运行特定进程,以便自动执行高能物理中的一些数据分析。但是,我偶尔会收到以下错误:
No screen session found.
我没有识别出要error
显示的特定模式,并且它似乎是随机发生的,我的目标是以不同的方式多次启动该程序command-line arguments
,有时在第二次执行时弹出此错误,有时在第三次执行时弹出。为了能够执行分析,我需要将特定命令发送到循环内定义的屏幕for
。代码如下:
#! /bin/zsh
### Script for running everything in screens ###
### System argument screen name suffix ###
echo You have the following screens running:
screen -ls
#echo Press any key to proceed. NOTE THAT YOUR OTHER SCREENS WILL GET KILLED!
#read
#pkill -15 -U arisevon screen ## We make sure that no screens are running for now
bkgarr=(TopJets BosonJets DiBoson TTbar)
sigarr=(NM1 NM2 NM3 Scenario4 Scenario6)
puarr=(50PU 140PU)
lumarr=(30 300 3000)
echo Please type 1 for 50PU samples and 2 for 140PU samples
read PU
if [[ $PU -ne 1 && $PU -ne 2 ]] ; then
echo You have to enter 1 or 2
return 1
fi
echo Please type 1 for 300fb-1 and 2 for 3000fb-1
read lum
if [[ $lum -ne 1 && $lum -ne 2 ]] ; then
echo You have to enter 1 or 2
return 1
fi
if [ $PU = 1 ]; then
let "lum = $lum + 1"
#echo $lum
fi
ex NEWrunReader.py <<EOEX
:43s/Lumi.*/Lumi=$lumarr[lum]/
:x
EOEX
echo Compiling the reader file!!!
root -l << EOF
.L readerSummerStd.C+
EOF
echo Press any key to proceed or Ctrl+C to abort!
read
for index in $bkgarr
do
screen -dmS "${index}_${lumarr[lum]}_${1}"
#screen -S $index -p 0 -X stuff "$(typeset -p bkgarr)"$'\r'
screen -S "${index}_${lumarr[lum]}_${1}" -p 0 -X stuff "./NEWrunReader.py SummerStd $puarr[PU]_$index $1 >& "${index}_${lumarr[lum]}_${1}".txt &"$'\r'
done
for sigind in $sigarr
do
screen -dmS "${sigind}_${lumarr[lum]}_${1}"
#screen -S $sigind -p 0 -X stuff "$(typeset -p bkgarr)"$'\r'
screen -S "${sigind}_${lumarr[lum]}_${1}" -p 0 -X stuff "./NEWrunReader.py SummerStd $puarr[PU]_$sigind $1 >& "${sigind}_${lumarr[lum]}_${1}".txt &"$'\r'
done
return 0