2016-07-05 90 views
-1

我有这样的bash代码住在文件:garuns_opt_my.scr用于循环变量控制bash脚本

#!/bin/bash 
#PBS -S /bin/bash 
#PBS -N garunsmodel 
#PBS -l mem=2g 
#PBS -l walltime=1:00:00 
#PBS -e error/error.txt 
#PBS -o error/output.txt 
#PBS -A improveherds_my 
#PBS -m ae 

set -x 


nodeDir=`mktemp -d /tmp/phuong.XXXXX` 
cp -r /group/dairy/phuongho/garuns $nodeDir 
cp /group/dairy/phuongho/jo/parity1/my/simplex.bin $nodeDir/garuns/simplex.bin 
cp /group/dairy/phuongho/jo/parity1/nttp.txt $nodeDir/garuns/my.txt 
cp /group/dairy/phuongho/jo/parity1/delay_input.txt $nodeDir/garuns/delay_input.txt 

cd $nodeDir/garuns 

module load gcc vle 

XXX=`pwd` 

sed -i "s|/group/dairy/phuongho/garuns/out|$XXX/out/|" exp/garuns.vpz 

awk 'NR == 1 || $8=="'$c'" my.txt > simplex-observed.txt 
awk 'NR == 1 || $7=="'$c'" {print $6}' delay_input.txt > afm_param.txt 
cp "/group/dairy/phuongho/garuns_param.txt" "$nodeDir/garuns/garuns_param.txt" 

./simplex.bin 


awk 'NR >1' < simplex-optimum-output.csv>> /group/dairy/phuongho/jo/parity1/my/finalresuls${c}.csv 
cp simplex-all-output.csv "/group/dairy/phuongho/jo/parity1/my/simplex-all-output${c}.csv" 
#awk '$28==1{print $1, $12,$26,$28,c}' c=$c out/exp_tempfile.csv > /group/dairy/phuongho/jo/parity1/my/simulated_my${c}.csv 
cp /out/exp_tempfile.csv /group/dairy/phuongho/jo/parity1/my/exp_tempfile${c}.csv 

rm simplex-observed.txt 
rm garuns_param.txt 

我试图使用外部for循环住的qsub上述bash脚本“N”时。run.sh文件

for rep in {1..2}; 
do qsub -V c=$rep garuns_opt_my.scr; 
sleep 7m; 
done 

两个garuns_opt_my.scr和run.sh被放置在相同的目录 然而,我收到以下错误:的qsub:脚本文件“C = 1”不能被加载 - 没有这样的文件或目录 你能帮我弄清楚什么是概率LEM。 另外,我不确定从run.sh传递变量rep到garuns_opt_my.scr的方式是否正确。 感谢

+2

请参阅http://stackoverflow.com/help/mcve - 一个问题应该有最小的代码量,这将允许别人重现相同的问题。 –

回答

1

qsub命令的使用权应该是:

qsub -V -c c=$rep garuns_opt_my.scr 

根据的qsub man pages

-c interval 
      Define whether the batch job should be checkpointed, and if so, 
      how often. 

    The qsub utility shall accept a value for the interval option-argument 
    that is one of the following: 

    n 
      No checkpointing shall be performed on the batch job 
      (NO_CHECKPOINT). 

    s 
      Checkpointing shall be performed only when the batch server is 
      shut down (CHECKPOINT_AT_SHUTDOWN). 

    c 
      Automatic periodic checkpointing shall be performed at the 
      Minimum_Cpu_Interval attribute of the batch queue, in units of 
      CPU minutes (CHECKPOINT_AT_MIN_CPU_INTERVAL). 

    c=minutes 
      Automatic periodic checkpointing shall be performed every 
      minutes of CPU time, or every Minimum_Cpu_Interval minutes, 
      whichever is greater. The minutes argument shall conform to the 
      syntax for unsigned integers and shall be greater than zero.