On Thu, Jun 24, 2010 at 4:15 AM, Hailiang Zhang <[log in to unmask]> wrote:
> Hi Tim:
>
> Thanks a lot for suggeting "exec" in my shell script. It really works
> under both shell and PBS; however, the running was just terminated right
> after "exec ${DIR}/lx_mapman" was excutated. I am not sure why this
> happens:-(
Hailiang, I use PBS all the time and I have no trouble running scripts
which are identical to those I run from the command line (in fact I
usually test the script on the command line first before submitting it
to the batch queue). I'm not clear why you thought it necessary to
use the 'source' command (which as Tim pointed out only works for
shell scripts, not for any kind of executable binary file).
What happens if you use exactly the same command under PBS as you
would from the command-line, i.e. in your example:
./lx_mapman
The 'exec' command you used is doing exactly what it was designed to
do, i.e. it replaces the current shell with the command specified by
exec, i.e. it's designed for 'chaining' a series of scripts or
executables. This of course means that any subsequent commands in the
shell script containing the 'exec' are ignored, so it only makes sense
to use 'exec' if it's the last command in a script. But in your
example use of 'exec' should be unnecessary anyway.
Hope this helps!
-- Ian
|