[Xymon] xymon, xymon-rclient and md5sum checks
Root, Paul T
Paul.Root at CenturyLink.com
Tue Jun 9 21:55:18 CEST 2015
Also, your solution doesn't work.
The test as written is testing that the variable $FILENAME is not null, and then testing to see if the file exists. Removing the -e just tests that the variable is not null twice.
The solution would be more like:
echo "if [ \"$FILENAME\" != \"\" -a -e \"$FILENAME\" ]; then"
-----Original Message-----
From: Xymon [mailto:xymon-bounces at xymon.com] On Behalf Of oliver
Sent: Tuesday, June 09, 2015 2:25 PM
To: Xymon at xymon.com
Subject: Re: [Xymon] xymon, xymon-rclient and md5sum checks
On Thu, Jun 4, 2015 at 10:10 PM, Jeremy Laidman
<jlaidman at rebel-it.com.au> 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.
_______________________________________________
Xymon mailing list
Xymon at xymon.com
http://lists.xymon.com/mailman/listinfo/xymon
This communication is the property of CenturyLink and may contain confidential or privileged information. Unauthorized use of this communication is strictly prohibited and may be unlawful. If you have received this communication in error, please immediately notify the sender by reply e-mail and destroy all copies of the communication and any attachments.
More information about the Xymon
mailing list