[rancid] Re: ignore certain diff's

David LaPorte david_laporte at harvard.edu
Wed May 24 16:58:58 UTC 2006

We do something similar to ignore access-list changes.  It's more
in-depth than simply grep'ing it (since there are context lines as well
you don't want to see), but hacking control_rancid as follows should work:

cvs -f diff -U 4 | sed -e '/^RCS file: /d' -e '/^--- /d' \
        -e '/^+++ /d' -e 's/^\([-+ ]\)/\1 /' >$TMP.diff


cvs -f diff -U 4 --ignore-matching-lines='^call-forward' | sed -e '/^RCS
file: /d' -e '/^--- /d' -e '/^+++ /d' -e 's/^\([-+ ]\)/\1 /' >$TMP.diff

For some reason, I seem to remember it would still email even if the
diff were blank, so I wrapped the email section in a:

DIFF=`cat $TMP.diff | grep -v "^===" | grep -v "^diff " | grep -v
"^Index: " | grep -v "^retrieving revision" | grep -v "^$"`
    if [ -n "$DIFF" ]; then
...email stuff here...

There may be a better way, but that has worked well for me.


Ryan Speed wrote:
> Howdy,
> I've got rancid checking a few cisco routers running Callmanager
> Express which has turned out to be a bit of an annoyance because when
> people forward their phones I get the diff emails sent out.  Before I
> go hacking away at the scripts could someone suggest an elegant way to
> add exceptions to the emailing of diffs?  I'm assuming a | grep -v
> call-forward in the right place would do the trick.
> Thanks,
> Ryan

More information about the Rancid-discuss mailing list