25.06.2015 Views

Administering Platform LSF - SAS

Administering Platform LSF - SAS

Administering Platform LSF - SAS

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 30<br />

External Job Submission and Execution Controls<br />

fi<br />

echo "Incorrect project name specified"<br />

exit $LSB_SUB_ABORT_VALUE<br />

USER=`whoami`<br />

if [ $LSB_SUB_PROJECT_NAME = "proj1" ]; then<br />

# Only user1 and user2 can charge to proj1<br />

if [$USER != "user1" -a $USER != "user2" ]; then<br />

echo "You are not allowed to charge to this project"<br />

exit $LSB_SUB_ABORT_VALUE<br />

fi<br />

fi<br />

Modifying job submission parameters<br />

esub can be used to modify submission parameters and the job environment<br />

before the job is actually submitted.<br />

The following example writes modifications to LSB_SUB_MODIFY_FILE for<br />

the following parameters:<br />

◆ LSB_SUB_QUEUE<br />

◆ USER<br />

◆ SHELL<br />

In the example, user userA can only submit jobs to queue queueA. User userB<br />

must use Bourne shell (/bin/sh), and user userC should never be able to<br />

submit a job.<br />

#!/bin/sh<br />

. $LSB_SUB_PARM_FILE<br />

# Redirect stderr to stdout so echo can be used for error<br />

messages<br />

exec 1>&2<br />

USER=`whoami`<br />

# Ensure userA is using the right queue queueA<br />

if [ $USER="userA" -a $LSB_SUB_QUEUE != "queueA" ]; then<br />

echo "userA has submitted a job to an incorrect queue"<br />

echo "...submitting to queueA"<br />

echo 'LSB_SUB_QUEUE="queueA"' > $LSB_SUB_MODIFY_FILE<br />

fi<br />

# Ensure userB is using the right shell (/bin/sh)<br />

if [ $USER="userB" -a $SHELL != "/bin/sh" ]; then<br />

echo "userB has submitted a job using $SHELL"<br />

echo "...using /bin/sh instead"<br />

echo 'SHELL="/bin/sh"' > $LSB_SUB_MODIFY_ENVFILE<br />

fi<br />

<strong>Administering</strong> <strong>Platform</strong> <strong>LSF</strong> 385

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!