2012-05-08 2 views
9

를 사용하여 쉘 스크립트를 실행 나는이 다음 쉘 스크립트 : 나는 내 자신의 명령 줄에서 실행할 때'예기치 않은 파일의 끝'과 '오류 함수 정의를 가져 오는'오류가 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를 사용할 때는 rror를 사용하지만 동일한 클러스터 시스템에서 직접 스크립트를 실행하는 경우에는 사용하지 마십시오. qsub를 사용하여 스크립트를 어떻게 실행합니까?

답변

2

모든 라인의 끝에 세미콜론을 추가하면 어떤 점에서 문제가 해결되지 않았습니다.

+0

/usr/share/Modules/init/bash의 모든 행에서? (여기에도 같은 문제가 있습니다.) – Eureka

+0

아니요 쉘 스크립트 끝에 –

1

대부분의 경우, 세미콜론을 추가하면 POSIX 줄 끝 (\ r \ n) 대신 DOS 줄 끝 (\ r \ n)으로 파일을 저장했습니다.

+0

dos2unix를 실행했는데 차이가 없습니다. 또한, 나는 리눅스에 그것을 썼다. 그리고 qsub를 사용하지 않고 같은 리눅스 클러스터에서 실행할 때 작동한다. –

4

/usr/share/Modules/init/bash에서 'export -f module'행을 주석 처리했습니다.

정상 로그인 셸에서는 modules.sh가 profile.d에서 호출되므로 module 명령을 사용할 수 있습니다. 비 로그인 셸에서는 래퍼 스크립트처럼 위의 파일을 먼저 소스합니다.

일반적으로 위의 파일을 소싱 한 후에 응용 프로그램 스크립트에서 추가 소싱을 의미하는 "module load apps/vendor/app"명령을 다시 제공합니다.

참조 : - http://gridengine.org/pipermail/users/2011-November/002019.html

9

또한 다른 bash 쉘 스크립트를 제출하는 데 사용하는 경우

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

를 사용하는 래퍼 스크립트에서이 문제가 있습니다.

: 그것은 밝혀 일들이 단순히 래퍼 스크립트 (안 랩 스크립트)의 상단에 다음과 같은 넣어 해결하는 annonying

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

(이에 CentOS 6.6에서 실행중인 Sun Grid Engine, Enterprise 버전 211.11입니다) 생산

unset module 

그게 전부입니다.