sleep command not found in torque pbs but works in shell

余生颓废 提交于 2019-12-24 13:02:24

问题


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

Then submitted the file testbps.

qsub testpbs

We got error messages:

more testpbs.sh.err

/var/spool/torque/mom_priv/jobs/8.centos64.SC: line 9: sleep: command not found

However, we ran sleep 20 in command line. No error occurs.

$sleep 20

Thanks in advance.

We ran echo $PATH in shell and got the following:

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

We use qstat -f jobid to review the details of this job.

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_MAIL=/var/spool/mail/root,

PBS_O_SHELL=/bin/bash,

PBS_O_LANG=en_US.UTF-8,

PBS_O_WORKDIR=/data/software/torque-4.2.6.1,

PBS_O_HOST=centos64,

PBS_O_SERVER=centos64

Thank larsks's great help. The following works:

#!/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

回答1:


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.

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


来源:https://stackoverflow.com/questions/21248406/sleep-command-not-found-in-torque-pbs-but-works-in-shell

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!