Platform LSF Administration Guide Version 6.2

Chapter 33
External Job Submission and Execution Controls
Administering Platform LSF
499
if [ $LSB_SUB_PROJECT_NAME != "proj1" -o $LSB_SUB_PROJECT_NAME != "proj2" ];
then
echo "Incorrect project name specified"
exit $LSB_SUB_ABORT_VALUE
fi
USER=`whoami`
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