[Xymon] "include: command not found" in apache logs

Henrik Størner henrik at hswn.dk
Thu Jul 26 08:52:27 CEST 2012


On 26-07-2012 06:36, cleaver at terabithia.org wrote:

[using cfg-files in shell scripts]

> I've proposed a patch to help with this kind of situation which adds
> "source " and ". " as synonyms for "include " to give you a little more
> flexibility in this regard.
>
> (Obviously, this would only work with single sourced files and not the
> full-on "directory " directive.)

I'm not too happy about doing that, especially since it doesn't handle 
the 'directory' include.

The correct way of doing this is to either run your script with xymoncmd 
- so all of the environment is setup before your script even starts - or 
to use xymoncfg to generate a single file with all of the include- and 
directory-stuff done. So instead of

#!/bin/sh
source /etc/xymon/xymonserver.cfg

you should do

#!/bin/sh
FN=`mktemp`
xymoncfg /etc/xymon/xymonserver.cfg >$FN
source $FN
rm $FN

The need for a temporary file is a bit of a kludge, so perhaps the 
attached patch for xymoncfg is a better solution. This provides a "-s" 
and "-c" option which will cause xymoncfg to output environment-variable 
definitions in Korn- or C-shell format, so you can do

#!/bin/sh
eval `xymoncfg -s /etc/xymon/xymonserver.cfg`

Similar to what you do with "ssh-agent". Does this seem like a workable 
solution ?


Regards,
Henrik

-------------- next part --------------
A non-text attachment was scrubbed...
Name: xymoncfg-shellvars.patch
Type: text/x-diff
Size: 1650 bytes
Desc: not available
URL: <http://lists.xymon.com/pipermail/xymon/attachments/20120726/9119a7aa/attachment.patch>


More information about the Xymon mailing list