#!/bin/sh

#. /usr/local/bcnu/etc/bcnuenv
. $BCNUHOME/agent/agent_head

BCNUAGENT="custom"	# set non standard agent to custom to prevent extra detail

for param in $BCNUPARAM
do
	bcnu_param
	DIR=$p1
	PERMS=$p2

	find $DIR -follow -perm $PERMS -ls |
	{
	while read dir
	do
	echo	$dir >>/tmp/perms.error
	lastdir=$dir
	done
	}
done
if [ -f /tmp/perms.error ]
	then
		BCNUMSG="$BCNU -m 'warning - ($lastdir) permissions ($PERMS)' -f /tmp/perms.error -e 5 $BCNUHOST"
		bcnu_err_send
		rm /tmp/perms.error
fi
