2012-05-08 48 views
9

運行錯誤shell腳本我有以下的shell:「意外的文件結尾」和「錯誤輸入函數定義」使用的qsub

#!/bin/sh 
cd /sw/local/bin/ 
export LD_LIBRARY_PATH=/sw/local/lib:/usr/local/Trolltech/Qt-4.7.2/lib:$LD_LIBRARY_PATH 
./FeatureFinderRaw -in /homes/JG-C1-18.mzML -out /homes/test_remove_after_use.featureXML -threads 20 

,當我從我自己的命令行運行它,它工作正常,但是當我儘量做到:

qsub -q ningal.q -cwd -V -o /homes/queue.out -e /queue.err featureFind_C1-18_20t.sh 

我得到以下錯誤:

/bin/sh: module: line 1: syntax error: unexpected end of file 
/bin/sh: error importing function definition for `module' 
./FeatureFinderRaw: error while loading shared libraries: libOpenMS.so: cannot open shared object file: No such file or directory 
/bin/sh: module: line 1: syntax error: unexpected end of file 
/bin/sh: error importing function definition for `module' 
./FeatureFinderRaw: error while loading shared libraries: libQtWebKit.so.4: cannot open shared object file: No such file or directory 
/bin/sh: module: line 1: syntax error: unexpected end of file 
/bin/sh: error importing function definition for `module' 
./FeatureFinderRaw: error while loading shared libraries: libQtWebKit.so.4: cannot open shared object file: No such file or directory 
/bin/bash: module: line 1: syntax error: unexpected end of file 
/bin/bash: error importing function definition for `module' 
./FeatureFinderRaw: error while loading shared libraries: libQtWebKit.so.4: cannot open shared object file: No such file or directory 
/bin/sh: module: line 1: syntax error: unexpected end of file 
/bin/sh: error importing function definition for `module' 
./FeatureFinderRaw: error while loading shared libraries: libQtWebKit.so.4: cannot open shared object file: No such file or directory 
/bin/sh: module: line 1: syntax error: unexpected end of file 
/bin/sh: error importing function definition for `module' 

我不明白爲什麼我得到這個電子使用qsub時發生錯誤,而不是直接在同一個羣集機器上運行腳本。我如何使用qsub運行腳本?

回答

2

由於某種原因,我不知道在每行末尾添加分號修復了問題。

+0

在/ usr/share/Modules/init/bash的每一行? (這裏有同樣的問題)。 – Eureka

+0

沒有在shellcript結尾 –

1

如果添加分號有所幫助,最可能的原因是您使用DOS行結尾(\ r \ n)而不是POSIX行結尾(\ r)保存文件。

+0

我跑了dos2unix,這沒有什麼區別。另外,我在linux上編寫它,當我在不使用qsub的情況下在同一個Linux集羣上運行它時,它可以工作。 –

4

在/ usr/share/Modules/init/bash中註釋掉'export -f module'一行。

在正常的登錄shell中,將從profile.d調用modules.sh,因此 模塊命令可用。在非登錄shell中,像應用程序 包裝腳本,它只是首先獲取上述文件。

通常在採購上面的文件後,應用程序腳本他們再次發出命令「模塊加載應用程序/供應商/應用程序」,這意味着額外的採購。

參考:: - http://gridengine.org/pipermail/users/2011-November/002019.html

9

也有在使用

qsub -shell no -b yes -cwd -V somescript.bash arg1 arg2 etc 

,如果你用它來提交其他的bash shell腳本包裝腳本這個問題。它產生的annonying

/bin/sh: module: line 1: syntax error: unexpected end of file 
/bin/sh: error importing function definition for `BASH_FUNC_module' 

(這是Sun Grid Engine的211.11在CentOS 6.6上運行)原來事情都是由簡單地把在包裝腳本(不是裹着腳本)的頂部以下解決:

unset module 

就是這樣。

相關問題