Question

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
Was it helpful?

Solution

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
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top