[hobbit] Alert on files out of sync?
d.tom.schmitt at L-3com.com
d.tom.schmitt at L-3com.com
Wed Feb 10 17:16:52 CET 2010
Just copy over the file from machineA (call it mfileA) to machineB. Assume file on B is mfileB.
Then do a 'diff' command and either trap the output or check the return code for zero = no difference.
Check the Return Code:
diff mfileA mfileB 2>&1 >/dev/null so there is no output created
if [ $? -eq 0 ]; then
Files both match
else
Files do not match
fi
or trap the input as in:
DATA=`diff mfileA mfileB 2>/dev/null` blocks error messages
if [ "$DATA" = "" ]; then
Files both match
else
Files do not match
fi
Thanks,
Tom Schmitt
Senior IT Staff - R&D
Salt Lake City, UT 84116
Phone (801) 594-3030
Cell (801) 231-7230
\\\\||////
\ ~ ~ /
| @ @ |
--oOo---(_)---oOo--
-----Original Message-----
From: wiskbroom at hotmail.com [mailto:wiskbroom at hotmail.com]
Sent: Wednesday, February 10, 2010 9:06 AM
To: hobbit at hswn.dk
Subject: RE: [hobbit] Alert on files out of sync?
> Greetings,
>
> I'm trying to figure out the best way for Xymon to alert when it detects that a httpd.conf file on two different webheads is different. Due to safety reasons we don't automate our web server config files, but rather use change control to keep them managed. I want to be able to see if someone modifies one config file on one server, but forgets to do it on the second one. I guess I could write a backend script to do it, but thought maybe there was a way to leverage the FILE monitor in hobbit-clients.cfg.
You could md5sum the file prior to your copy over, then test the results to determine that they match.
So,
1. Create new file.
2. md5sum the file, saving output to test against.
3. copy the file over using your usual methods.
4. run md5sum on both servers, they should match.
The only problem I see here is that you will have to auto-gen an md5sum signature each time you modify your files.
.vadim
To unsubscribe from the hobbit list, send an e-mail to
hobbit-unsubscribe at hswn.dk
More information about the Xymon
mailing list