2012-05-08 18 views
9

Tôi có shellscript sau:'cuối tệp không mong đợi' và 'lỗi khi nhập định nghĩa hàm' lỗi chạy shellscript sử dụng 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 

Nó hoạt động tốt khi tôi chạy nó từ dòng lệnh của riêng tôi, nhưng khi tôi cố gắng làm:

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

tôi nhận được lỗi sau:

/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' 

tôi không hiểu tại sao tôi nhận được e này rror khi sử dụng qsub, nhưng không phải khi chạy script trực tiếp trên cùng một máy cluster. Làm thế nào tôi có thể chạy một kịch bản bằng cách sử dụng qsub?

Trả lời

2

Vì một lý do nào đó mà tôi không thể thêm dấu chấm phẩy vào cuối mỗi dòng đã khắc phục được sự cố.

+0

Tại mỗi dòng/usr/share/Modules/init/bash? (Có cùng một vấn đề ở đây). – Eureka

+0

Không có ở phần cuối của shellscript –

1

Nguyên nhân rất có thể là bạn đã lưu tệp có đuôi dòng DOS (\ r \ n) thay vì kết thúc dòng POSIX (\ r) nếu thêm dấu chấm phẩy tạo sự khác biệt.

+0

Tôi chạy dos2unix, điều đó không tạo nên sự khác biệt. Ngoài ra, tôi đã viết nó trên Linux và nó hoạt động khi tôi chạy nó trên cùng một cụm linux mà không cần sử dụng qsub. –

4

Trong/usr/share/Modules/init/bash đã nhận xét dòng 'export -f module'.

Trong vỏ đăng nhập thông thường, modules.sh sẽ được gọi từ hồ sơ.d do đó lệnh mô-đun có sẵn. Trong một shell không đăng nhập, giống như một tập lệnh wrapper ứng dụng, nó chỉ cung cấp tệp ở trên trước.

Nói chung trong kịch bản ứng dụng sau khi tìm nguồn cung ứng ở trên tệp, họ lại đưa ra lệnh "ứng dụng tải mô-đun/nhà cung cấp/ứng dụng" có nghĩa là tìm nguồn cung ứng bổ sung.

tham khảo :: - http://gridengine.org/pipermail/users/2011-November/002019.html

9

Cũng có vấn đề này trong một kịch bản wrapper có sử dụng

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

nếu bạn sử dụng nó để gửi lên một kịch bản bash shell. Nó tạo ra các annonying

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

(đây là Sun Grid Engine 211,11 chạy trên CentOS 6.6) Hóa ra mọi thứ được giải quyết bằng cách đơn giản là đặt sau đây trên đầu của kịch bản wrapper (không của kịch bản bọc):

unset module 

Đó là tất cả.

Các vấn đề liên quan