#!/bin/sh for vserv in `/usr/sbin/vserver-list --running` do #echo vserv = $vserv ACCT=/var/run/vacct/acct-$vserv.log COMMONREF=/var/lib/forrest/$vserv.common.ref REF=/var/lib/forrest/$vserv.ref DIFF=/var/log/forrest/$vserv.tmp MAINEXFILE=/var/lib/forrest/exclude.lst EXFILE=/var/lib/forrest/exclude-$vserv.lst EVFILE=/var/log/forrest/$vserv.events if [ ! -f $MAINEXFILE ] ; then MAINEXFILE=/dev/null fi if [ ! -f $EXFILE ] ; then EXFILE=/dev/null fi if [ -f "$ACCT" -a -f "$REF" ] ; then EXTRACOMP= if [ -f "$COMMONREF" -o -d "$COMMONREF" ] ; then EXTRACOMP="--compare $COMMONREF" fi mkdir -p /var/log/forrest if /usr/sbin/forrest --facct $ACCT $EXTRACOMP --compare $REF --excludefile $MAINEXFILE --excludefile $EXFILE --eventfile $EVFILE >$DIFF then # Nothing to report true rm -f $DIFF.sent elif cmp --quiet $DIFF $DIFF.sent 2>/dev/null then # There are process trees not in the reference # but we have already told the admin about this problem true else EMAILS=/etc/forrest-monitor-emails.lst if [ -f $EMAILS ]; then cat $DIFF | mail -s "forrest $vserv" `cat $EMAILS` fi mv -f $DIFF $DIFF.sent fi fi done