I have shell script and want to disable it's execution as normal job. It should be executed only as bjob in LSF
How can I make sure this with in script
lsfError="**ERROR: Local jobs disabled. Please run through LSF only --"
lsfExit=2
lsfLog="$(getent passwd $(id -un) | cut -d: -f6)/.lsbatch/.lsf_${LSB_JOBID}.log"
echo "**INFO: Verifying as LSF job ..."
sleep 2s
if [ -z "$LSB_JOBID" ]; then
echo "$lsfError"; exit $lsfExit
elif [[ "$(bjobs $LSB_JOBID 2>&1)" =~ "not found" ]]; then
echo "**ERROR: Job $LSB_JOBID doesn't exist" > $lsfLog
echo "$lsfError"; exit $lsfExit
elif [[ "$(bjobs -o 'command' -noheader $LSB_JOBID 2>&1)" != "$0" ]]; then
echo "**ERROR: Command not matched $(bjobs -o "command" -noheader $LSB_JOBID 2>&1) != $0" > $lsfLog
echo "$lsfError"; exit $lsfExit
fi