SGE群集-提交后脚本失败-在终端中工作 [英] SGE Cluster - script fails after submission - works in terminal
问题描述
我有一个脚本要提交给SGE集群(在Redhat Linux上).脚本的第一部分将完整CWD路径中的当前文件夹定义为要在下游使用的变量:
I have a script that I am trying to submit to a SGE cluster (on Redhat Linux). The very first part of the script defines the current folder from the full CWD path, as a variable to use downstream:
#!/usr/bin/bash
#
#$ -cwd
#$ -A username
#$ -M user@server
#$ -j y
#$ -m aes
#$ -N test
#$ -o test.log.txt
echo 'This is a test.'
result="${PWD##*/}"
echo $result
在bash中,它按预期工作:
In bash, this works as expected:
CWD:
-bash-4.1$ pwd
/home/user/test
运行脚本:
-bash-4.1$ bash test.sh
This is a test.
test
当我将作业提交到集群时:
When I submit the job to the cluster:
-bash-4.1$ qsub -V test.sh
并检查日志文件:
This is a test.
Missing }.
有人知道为什么作业提交可以直接在命令行中工作时为什么说"Missing}"吗?我不确定我在这里想念什么.
Does anyone know why the job submission is saying "Missing } " when it works right from the command-line? I'm not sure what I'm missing here.
谢谢.
推荐答案
批处理调度程序的posix标准要求他们忽略#!行,而是使用配置到群集中的外壳程序或由qsub的-S选项选择的外壳程序.缺省通常是csh.因此,在脚本中添加诸如#$ -S /usr/bin/bash
之类的内容将导致bash对其进行解释.
The posix standard for batch schedulers requires them to ignore the #! line and instead use either a shell configured into the cluster or one selected by the -S option of qsub. The default is usually csh. So adding something like #$ -S /usr/bin/bash
into the script will cause it to be interpreted by bash.
或者,您可以说服集群管理员将队列从posix_compatible更改为unix_behavior.
Alternatively you could convince the cluster admin to change the queues to unix_behavior from posix_compliant.
这篇关于SGE群集-提交后脚本失败-在终端中工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!