LSF Version 7.3 - Administering Platform LSF

Administering Platform LSF 579
External Job Submission and Execution Controls
if [ $LSB_SUB_PROJECT_NAME = "proj1" ]; then
# Only user1 and user2 can charge to proj1
if [$USER != "user1" -a $USER != "user2" ]; then
echo "You are not allowed to charge to this project"
exit $LSB_SUB_ABORT_VALUE
fi
fi
Modifying job submission parameters
esub can be used to modify submission parameters and the job environment before
the job is actually submitted.
The following example writes modifications to LSB_SUB_MODIFY_FILE for the
following parameters:
LSB_SUB_QUEUE
USER
SHELL
In the example, user
userA can only submit jobs to queue queueA. User userB must
use Bourne shell (
/bin/sh), and user userC should never be able to submit a job.
#!/bin/sh
. $LSB_SUB_PARM_FILE
# Redirect stderr to stdout so echo can be used for error messages
exec 1>&2
USER=`whoami`
# Ensure userA is using the right queue queueA
if [ $USER="userA" -a $LSB_SUB_QUEUE != "queueA" ]; then
echo "userA has submitted a job to an incorrect queue"
echo "...submitting to queueA"
echo 'LSB_SUB_QUEUE="queueA"' > $LSB_SUB_MODIFY_FILE
fi
# Ensure userB is using the right shell (/bin/sh)
if [ $USER="userB" -a $SHELL != "/bin/sh" ]; then
echo "userB has submitted a job using $SHELL"
echo "...using /bin/sh instead"
echo 'SHELL="/bin/sh"' > $LSB_SUB_MODIFY_ENVFILE
fi
# Deny userC the ability to submit a job
if [ $USER="userC" ]; then
echo "You are not permitted to submit a job."
exit $LSB_SUB_ABORT_VALUE
fi
Using bmod and brestart commands with mesub
You can use the bmod command to modify job submission parameters, and
brestart to restart checkpointed jobs. Like bsub, bmod and brestart also call
mesub, which in turn invoke any existing esub executables in LSF_SERVERDIR.
bmod and brestart cannot make changes to the job environment through mesub
and
esub. Environment changes only occur when mesub is called by the original job
submission with
bsub.