扭矩pbs中未找到sleep命令,但可在shell中使用 [英] sleep command not found in torque pbs but works in shell
问题描述
我们创建一个扭矩pbs文件" testpbs ",如下所示:
We create a torque pbs file "testpbs" as follows:
#!/bin/sh
#PBS -N T1272_flt
#PBS -q batch
#PBS -l nodes=1:ppn=1
#PBS -o /data/software/torque-4.2.6.1/testpbs.sh.out
#PBS -e /data/software/torque-4.2.6.1/testpbs.sh.err
sleep 20
然后提交文件testbps.
Then submitted the file testbps.
qsub testpbs
qsub testpbs
我们收到了错误消息:
更多testpbs.sh.err
more testpbs.sh.err
/var/spool/torque/mom_priv/jobs/8.centos64.SC:第9行:sleep:命令 找不到
/var/spool/torque/mom_priv/jobs/8.centos64.SC: line 9: sleep: command not found
但是,我们在命令行中运行了 sleep 20 .没有错误发生.
However, we ran sleep 20 in command line. No error occurs.
$ sleep 20
$sleep 20
谢谢.
我们在shell中运行了 echo $ PATH 并得到了以下信息:
We ran echo $PATH in shell and got the following:
回显$ PATH
echo $PATH
/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.9.x86_64/bin:/data/software/cufflinks-2.0.2 .Linux_x86_64:/home/amin/bin/blast-2.2.19:/root/bin:/home/amin/bin
/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.9.x86_64/bin:/data/software/cufflinks-2.0.2.Linux_x86_64:/home/amin/bin/blast-2.2.19:/root/bin:/home/amin/bin
我们使用 qstat -f jobid 来查看此作业的详细信息.
We use qstat -f jobid to review the details of this job.
PBS_O_LOGNAME = amin,
PBS_O_LOGNAME=amin,
PBS_O_PATH =/usr/lib64/qt-3.3/bin:/usr/local/sbin :/usr/local/bin : /sbin:/bin :/usr/sbin:/usr/bin :/sbin:/bin:/usr/sbin:/usr/bin: /usr/X11R6/bin:/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.9.x86_64/bin: /data/software/cufflinks-2.0.2.Linux_x86_64: /home/amin/bin/blast-2.2.19:/root/bin:/home/aimin/bin,
PBS_O_PATH= /usr/lib64/qt-3.3/bin: /usr/local/sbin: /usr/local/bin: /sbin: /bin: /usr/sbin: /usr/bin: /sbin:/bin: /usr/sbin: /usr/bin: /usr/X11R6/bin: /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.9.x86_64/bin: /data/software/cufflinks-2.0.2.Linux_x86_64: /home/amin/bin/blast-2.2.19: /root/bin: /home/aimin/bin,
PBS_O_MAIL =/var/spool/mail/root,
PBS_O_MAIL=/var/spool/mail/root,
PBS_O_SHELL =/bin/bash,
PBS_O_SHELL=/bin/bash,
PBS_O_LANG = zh_CN.UTF-8,
PBS_O_LANG=en_US.UTF-8,
PBS_O_WORKDIR =/data/software/torque-4.2.6.1,
PBS_O_WORKDIR=/data/software/torque-4.2.6.1,
PBS_O_HOST = centos64,
PBS_O_HOST=centos64,
PBS_O_SERVER = centos64
PBS_O_SERVER=centos64
感谢Larsks的大力帮助.以下工作原理:
#!/bin/sh
#PBS -N T1272_flt
#PBS -q batch
#PBS -l nodes=1:ppn=1
#PBS -o /data/software/torque-4.2.6.1/testpbs.sh.out
#PBS -e /data/software/torque-4.2.6.1/testpbs.sh.err
export PATH=$PBS_O_PATH
sleep 20
推荐答案
尝试将sleep
替换为命令的完整路径(可能是/usr/bin/sleep
),看看是否会改变行为.如果是这样,那么您的脚本在Torque下运行时,只是具有一个不同的(或为空)$PATH
变量.
Try replacing sleep
with the full path to the command (possibly /usr/bin/sleep
) and see if that changes the behavior. If it does, then your script, when run under Torque, simply has a different (or empty) $PATH
variable.
您可以(a)继续使用显式路径,或(b)在脚本中显式设置$PATH
,例如:
You can either (a) continue to use explicit paths, or (b) set $PATH
explicitly in your script, e.g:
PATH=/bin:/usr/bin:/usr/local/bin
这篇关于扭矩pbs中未找到sleep命令,但可在shell中使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!