On Thu, Jul 5, 2018 at 3:22 PM, Belgin, Mehmet
<
mehmet...@oit.gatech.edu> wrote:
> I find scheduler related checks extremely useful, but our manual torque/moab
> installations are in non-stand paths (namely /opt/torque/current and
> /opt/moab/current). As a result, commands in lbnl_moab.nhc are failing. I
> can configure some of these manually, e.g.:
>
> * || export MDIAG_CMD=/opt/moab/current/bin/mdiag
>
> but not everything has a variable defined this way(e.g. qmgr). As a bandaid,
> I added all paths as follows:
>
> * || export
> PATH=/opt/torque/current/sbin:/opt/torque/current/bin:/opt/moab/current/bin:/opt/moab/current/sbin:$PATH
>
> which works fine, but it’s too ugly for my taste. I’m sure there is a much
> more elegant way to setup env variables for NHC.
>
> So… is there a way to tell NHC to source some specific files (e.g. those in
> profile.d) before it runs, without touching any of its source code?
Actually, that is probably the right answer.
There are 2 ways to effect changes to NHC's environment in the general
sense. One is, as you show above, to put directives in the config to
alter the shell variables like PATH. The other is to use
/etc/sysconfig/nhc (or, if you're using multiple named contexts,
/etc/sysconfig/NAME).
If you check out the NHC docs, you'll see a table of NHC variables
(
https://github.com/mej/nhc#supported-variables), some of which are
marked with an asterisk (*). Those are the variables that are used by
NHC *before* the lines from the config file are evaluated; they
therefore cannot be effectively manipulated via the config file and
must instead be modified in /etc/sysconfig/nhc.
The PATH variable is not marked with an asterisk because setting it in
the config works just fine, but you could conceivably set it in
/etc/sysconfig/nhc instead or in addition. Up to you.
The alternative is setting an absolute path for each individual *_CMD
variable, and as you said, that's not always possible (though it
arguably should be).
Michael
--
Michael Jennings (KainX)
https://medium.com/@mej0/ <
m...@eterm.org>
Linux/HPC Systems Engineer, LANL.gov Author, Eterm (
www.eterm.org)
-----------------------------------------------------------------------
"The trouble with doing something right the first time is that nobody
appreciates how difficult it was." -- Walt West