Platform LSF Administration Guide Version 6.2

Chapter 31
Pre-Execution and Post-Execution Commands
Administering Platform LSF
483
If both queue and job-level pre-execution commands are specified, the job-level
pre-execution is run after the queue-level pre-execution command.
UNIX
The entire contents of the configuration line of the pre- and post-execution commands
are run under
/bin/sh -c, so shell features can be used in the command.
For example, the following is valid:
PRE_EXEC = /usr/share/lsf/misc/testq_pre >> /tmp/pre.out
POST_EXEC = /usr/share/lsf/misc/testq_post | grep -v "Hey!"
The pre- and post-execution commands are run in /tmp.
Standard input and standard output and error are set to
/dev/null. The output from
the pre- and post-execution commands can be explicitly redirected to a file for
debugging purposes.
The PATH environment variable is set to:
PATH='/bin /usr/bin /sbin /usr/sbin'
Windows
The pre- and post-execution commands are run under cmd.exe /c.
Standard input and standard output and error are set to NULL. The output from the
pre- and post-execution commands can be explicitly redirected to a file for debugging
purposes.
See “LSB_PRE_POST_EXEC_USER parameter (lsf.sudoers)” on page 483.
See the Platform LSF Reference for information about the
lsf.sudoers file.
Example
The following queue specifies the pre-execution command
/usr/share/lsf/pri_prexec and the post-execution command
/usr/share/lsf/pri_postexec.
Begin Queue
QUEUE_NAME = priority
PRIORITY = 43
NICE = 10
PRE_EXEC = /usr/share/lsf/pri_prexec
POST_EXEC = /usr/share/lsf/pri_postexec
End Queue
LSB_PRE_POST_EXEC_USER parameter (lsf.sudoers)
By default, both the pre- and post-execution commands are run as the job submission
user. Use the LSB_PRE_POST_EXEC_USER parameter in
lsf.sudoers to specify
a different user ID for queue-level pre- and post-execution commands.
Example
For example, if the pre- or post-execution commands perform privileged operations
that require root permission, specify:
LSB_PRE_POST_EXEC_USER=root
See the Platform LSF Reference for information about the lsf.sudoers file.