We have some shell scripts that presently utilize Platform LSF to manage job execution.
These scripts will eventually be migrated to an environment that uses a different job scheduler.
During the migration phase it would be ideal to have the same script support job scheduling in both environments, so if it detects that the LSF environment is present, it uses LSF-specific instructions, else it uses the commands relevant to the other environment.
I've thought of a few possible solutions:
Check for LSF-specific environment variables
if [[ -n $LSF_BINDIR ]]; then # Yes LSF else # No LSF fi
Check for the availability of LSF-specific commands
if [[ -z $( which bsub 2>&1 | grep "/usr/bin/which" ) ]]; then # LSF present else # LSF absent fi
I don't know if these checks are sufficient, or whether there is a better (as in less hacky), more reliable method for detecting the presence of Platform LSF on a system.