使用qsub在另一个bash脚本中调用bash脚本
问题描述:
我想在使用qsub的另一个bash脚本中运行bash脚本(因为我需要在集群上运行实际问题)。使用qsub在另一个bash脚本中调用bash脚本
下面是这个问题的演示。我有两个脚本如下:
脚本1:
#!/bin/bash -f
sh ./script2.sh
脚本2:
#!/bin/bash
echo "It works fine!"
现在,如果我把这两个脚本文件夹中,并使用命令sh script1.sh
,它会正常工作。但是,如果使用qsub命令来运行它qsub script1.sh
它将通过一个错误:
SH:./script2.sh:没有这样的文件或目录
我怎样才能解决这个问题?
答
To define the working directory path to be used for the job -d option can be used. If it is not specified, the default working directory is the home directory.
检查您的工作目录。
#!/bin/bash -f
echo "Working directory is $PWD"
sh ./script2.sh
您可以使用-d
选项来解决这个问题。
qsub -d <working directory> script1.sh