#!/usr/bin/sh
HOST_NAME=`uname -n`
if [ ! -e /var/lib/tripwire/${HOST_NAME}.twd ] ; then
	echo "****    Error: Tripwire database for ${HOST_NAME} not found.    ****"
	echo "**** Run \"/etc/tripwire/twinstall.sh\" and/or \"tripwire --init\". ****"
elif [ -f /etc/tripwire/tw.cfg ]; then
	# if GLOBALEMAIL is configured, use it rather than cron mail
	if [ -n "`/usr/bin/twadmin -m f | sed -n 's/^GLOBALEMAIL\W*=//p'`" ]; then
		/usr/bin/tripwire --check --email-report --silent --no-tty-output
	else
		/usr/bin/tripwire --check
	fi
fi
