Xymon Mailing List Archive search

xymon, xymon-rclient and md5sum checks

list Oliver
Tue, 9 Jun 2015 15:24:42 -0400
Message-Id: <user-99bea32e1054@xymon.invalid>

On Thu, Jun 4, 2015 at 10:10 PM, Jeremy Laidman
<user-71895fb2e44c@xymon.invalid> wrote:
No, it's not using "stat".  Instead, it's using a series of shell commands,
and in some cases (such as for the "*time" and "group" lines) a bit of perl.
If you're interested, you can check how it's all done in the
send_logfetch_file() function (from line 323).  This function essentially
creates a sequence of commands that get sent to the shell on the remote
client.

I have no idea why it's not working for Solaris.  But I can confirm that
it's not working for my Solaris boxes also.  This means I can do some
testing here and (I hope) come up with a fix.  Sorry I can't offer any more
at this stage.
I think I see the problem.

Line 310:
echo "if [ \"$FILENAME\" -a -e \"$FILENAME\" ]; then"

If I construct a similar command on a linux box, I get this:
$ [ /etc/sudoers -a -e /etc/sudoers ] && echo hello
hello

but on Solaris, I get this:
$ [ /etc/sudoers -a -e /etc/sudoers ] && echo hello
test: argument expected

I guess you could drop the -e and it will still work for both
linux/solaris or add another 'if' statement.... something like this
(but I'm not sure if this is the best way:)

        if [ "$OSTYPE" = "sunos" ] || [ "$SCRIPTOS" = "sunos" ]; then
          echo "if [ \"$FILENAME\" -a \"$FILENAME\" ]; then"
        else
          echo "if [ \"$FILENAME\" -a -e \"$FILENAME\" ]; then"
        fi

Either way, it's working for me now using the 'if' method - but
Solaris and Linux is all I have.  If there's a better way to do it,
please let me know.