Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'Unexpected end of file' and 'error importing function definition' error running shellscript using qsub

I have the following shellscript:

#!/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

It works fine when I run it from my own command line, but when I try to do:

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

I get the following error:

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

I don't understand why I get this error when using qsub, but not when running the script directly on the same cluster machine. How can I run a script using qsub?

like image 982
Niek de Klein Avatar asked May 08 '12 10:05

Niek de Klein


People also ask

How fix Unexpected end of file in Linux?

An Unexpected end of file error in a Bash script usually occurs when you there is a mismatched structure somewhere in the script. If you forget to close your quotes, or you forget to terminate an if statement, while loop, etc, then you will run into the error when you try to execute your Bash script.

What is unexpected end of file syntax error?

Unexpected End of File errors can occur when a file doesn't have the proper closing tags. Sometimes this error can present itself as the white screen of death, or a 500 error.

How do you end a file in bash?

One of the many known methods to exit a bash script while writing is the simple shortcut key, i.e., “Ctrl+X”. While at run time, you can exit the code using “Ctrl+Z”.


1 Answers

Also have this problem in a wrapper script that uses

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

if you use it to submit another bash shell script. It produces the annonying

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

(this is Sun Grid Engine 211.11 running on CentOS 6.6) Turns out things are solved by simply putting the following on top of the wrapper script (not of the wrapped script):

unset module

That's all.

like image 114
plijnzaad Avatar answered Nov 16 '22 04:11

plijnzaad