"include: command not found" in apache logs
On 26-07-2012 06:36, user-87556346d4af@xymon.invalid 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
Attachments (1)