English 中文(简体)
script unable to find directories/files when running from qsub cluster script
原标题:

I m calling several unix commands and python on a python script from a qsub shell script, meant to run on a cluster. The trouble is that when the script executes, something seems to go awry in the shell, so that directories and files that exist are not found. For example, in the .out output files of qsub I see the following errors:

cd: /valid/dir/name: No such file or directory
python valid/script/name.py 
python: can t open file  valid/script/name.py : [Errno 2] No such file or directory

so the script cannot cd into a dir that definitely exist. Similarly, calling python on a python script that definitely exists yields an error.

any idea what might be going wrong here, or how I could try to debug this?

thanks very much.

问题回答

the errors are pretty self explanatory. make sure /valid/dir/name is actually a directory. You can put this in your shell script to create this directory if not found.

if [ ! -d "/valid/dir/name" ];then
   mkdir -p /valid/dir/name
fi

As for Python error, because there s no "valid" directory, it gives you error.

Does this directory exist on every possible compute node? Remember that the script won t necessarily execute on the host you submit it from. Try adding the python equivalent of echo hostname to your script and then verifying that the directory exists on that host.





相关问题
KornShell- Creating a fixed width text file

I need to create a simple fixed width text file in KornShell (ksh). My current attempt using printf to pad the string isn t working out very well. What s the shortest, cleanest way to create a fixed ...

unix find command

how to use the find command to find files/directories which are not matching the pattern. for eg: find <some options > -name "dontfile.txt" should give me output of all the find whose file ...

encoding of file shell script

How can I check the file encoding in a shell script? I need to know if a file is encoded in utf-8 or iso-8859-1. Thanks

Case insensitive comparison of strings in shell script

The == operator is used to compare two strings in shell script. However, I want to compare two strings ignoring case, how can it be done? Is there any standard command for this?

1. 露台式照像

在Windows XP中,没有一时出现指挥时,是否有办法操作一种灰色文字? 我常常需要把“善待”(工作)与“灰色”同起来,即使我的文字没有产出,......

热门标签