<div dir="ltr">Thanks for the suggestions. The "su xymon" was the clincher; it turns out this was indeed a permissions problem rather than an environment problem. bbcmd wasn't helping because I wasn't changing the user running the script. I modified the user permissions of the xymon user and things worked fine.<div>Thanks all!</div><div><br><div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, May 18, 2016 at 9:49 PM, J.C. Cleaver <span dir="ltr"><<a href="mailto:cleaver@terabithia.org" target="_blank">cleaver@terabithia.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Another possibility here is that there's a distinction between the client<br>
and server environments that's causing it to not properly report in "to<br>
itself."<br>
<br>
When running bbcmd, can you use bbcmd --env=/path/to/hobbitserver.cfg and<br>
--env=/path/to/hobbitclient.cfg and see if there's a difference?<br>
<br>
<br>
-jc<br>
<br>
<br>
On Wed, May 18, 2016 2:19 pm, Jeremy Laidman wrote:<br>
> A few ideas:<br>
><br>
> Su to the xymon user first, then run bbcmd.<br>
><br>
> Run the command "env > /to/env" in the script and compare the file between<br>
> xymon running and you running.<br>
><br>
> Add "set -x" before the vboxmanage command and "set +x" after.<br>
><br>
> Cheers<br>
> Jeremy<br>
><br>
> On Wed, 18 May 2016, 14:31 More Grey <<a href="mailto:moregrey@gmail.com">moregrey@gmail.com</a>> wrote:<br>
><br>
>> Hello--<br>
>><br>
>> I have a xymon client test script that runs fine, as scheduled,<br>
>> returning<br>
>> the appropriate results. I added an additional test to the script that<br>
>> fails when the script is run on schedule, but which succeeds when the<br>
>> script is run manually. The new test is a call to VirtualBox's<br>
>> VBoxManage<br>
>> command, to list the existing VMs. When run by xymon, it appears that<br>
>> the<br>
>> call to VBoxManage is not being sent all the parameters. If I change the<br>
>> command to just "VBoxManage", the command returns the help message for<br>
>> VBoxManage. If I change the command to "VBoxManage list", the command<br>
>> returns the help message for the "list" command. But the command<br>
>> "VBoxManage list vms" returns nothing. When the script is run manually<br>
>> or<br>
>> within bbcmd, the call to "VBoxManage list vms" works as expected.<br>
>><br>
>> Below is a version of the script with just my new test (plus plenty of<br>
>> debugging info):<br>
>><br>
>> #!/bin/sh<br>
>> # wrapper for firing off the client tests<br>
>><br>
>> echo $(date) "!!! testing VBoxManage"<br>
>> echo $(date) "!!! HOBBITCLIENTHOME=$HOBBITCLIENTHOME"<br>
>> echo $(date) "!!! BBHOME=$BBHOME"<br>
>> echo $(date) "!!! calling VBoxManage:"<br>
>> /usr/lib/virtualbox/VBoxManage list vms<br>
>> echo $(date) "!!! return code = $?"<br>
>> echo $(date) "!!! after VBoxManage"<br>
>><br>
>> When this script runs as part of normal xymon operation (every 5<br>
>> minutes,<br>
>> in this case), I get the following output in my log file:<br>
>><br>
>> Tue May 17 23:04:48 UTC 2016 !!! testing VBoxManage<br>
>> Tue May 17 23:04:48 UTC 2016 !!! HOBBITCLIENTHOME=/opt/mon/hobbit/client<br>
>> Tue May 17 23:04:48 UTC 2016 !!! BBHOME=/opt/mon/hobbit/client<br>
>> Tue May 17 23:04:48 UTC 2016 !!! calling VBoxManage:<br>
>> Tue May 17 23:04:48 UTC 2016 !!! return code = 0<br>
>> Tue May 17 23:04:48 UTC 2016 !!! after VBoxManage<br>
>><br>
>> But when I run the script directly from the tests.d directory, or when I<br>
>> run it using bbcmd, I get the following output:<br>
>><br>
>> 2016-05-17 23:08:46 Using default environment file<br>
>> /opt/mon/hobbit/client/etc/hobbitclient.cfg<br>
>> Tue May 17 23:08:46 UTC 2016 !!! testing VBoxManage<br>
>> Tue May 17 23:08:46 UTC 2016 !!! HOBBITCLIENTHOME=/opt/mon/hobbit/client<br>
>> Tue May 17 23:08:46 UTC 2016 !!! BBHOME=/opt/mon/hobbit/client<br>
>> Tue May 17 23:08:46 UTC 2016 !!! calling VBoxManage:<br>
>> "VM-00" {f428809a-e08e-2164-a52a-34405d323b18}<br>
>> "VM-01" {8d9d188f-3f80-4fe4-99b2-7b740b3bd841}<br>
>>     [ output omitted ]<br>
>> "VM-11" {77145415-2130-4280-84da-1b06e78a110f}<br>
>> "VM-12" {b91ae190-74a9-a4e7-9643-142fab9b29a9}<br>
>> Tue May 17 23:08:47 UTC 2016 !!! return code = 0<br>
>> Tue May 17 23:08:47 UTC 2016 !!! after VBoxManage<br>
>><br>
>> I tried moving the VBoxManage command to a separate script and calling<br>
>> the<br>
>> script instead of the command; same behavior. I tried running the<br>
>> VBoxManage command in a subshell within the script; same behavior.<br>
>> Relying<br>
>> on the environment PATH or specifying the full path of the VBoxManage<br>
>> executable made no difference. If this were a permission problem, why<br>
>> would<br>
>> VBoxManage run at all (in the cases where it returns a help message)?<br>
>> What am I missing here?<br>
>> Thanks for any suggestions!<br>
>><br>
>> _______________________________________________<br>
>> Xymon mailing list<br>
>> <a href="mailto:Xymon@xymon.com">Xymon@xymon.com</a><br>
>> <a href="http://lists.xymon.com/mailman/listinfo/xymon" rel="noreferrer" target="_blank">http://lists.xymon.com/mailman/listinfo/xymon</a><br>
>><br>
> _______________________________________________<br>
> Xymon mailing list<br>
> <a href="mailto:Xymon@xymon.com">Xymon@xymon.com</a><br>
> <a href="http://lists.xymon.com/mailman/listinfo/xymon" rel="noreferrer" target="_blank">http://lists.xymon.com/mailman/listinfo/xymon</a><br>
><br>
<br>
<br>
</blockquote></div><br></div></div></div></div>