Here's another variation due to security setting in Solaris:
chown -R $USER:$GROUP wily
if [ $ACCESS == tight ]; then # $GROUP group can read, others can't; all can write to logs
if [ $OS_VERSION = "SunOS" ]; then
find wily -perm -u+r | xargs -I {} chmod g+r {}
chmod -R o-r wily
chmod -R go-w wily
chmod -R o+w wily/logs
find wily -perm -u+x | xargs -I {} chmod g+x {}
chmod -R o-x wily
else
find wily -perm -u+r | xargs -I "{}" chmod g+r "{}"
chmod -R o-r wily
chmod -R go-w wily
chmod -R o+w wily/logs
find wily -perm -u+x | xargs -I "{}" chmod g+x "{}"
chmod -R o-x wily
fi
else # $GROUP group can write, others can read; all can write to logs
if [ $OS_VERSION = "SunOS" ]; then
find wily -perm -u+r | xargs -I {} chmod go+r {}
find wily -perm -u+w | xargs -I {} chmod g+w {}
chmod -R o-w wily
chmod -R o+w wily/logs
find wily -perm -u+x | xargs -I {} chmod go+x {}
else
find wily -perm -u+r | xargs -I "{}" chmod g+r "{}"
find wily -perm -u+w | xargs -I "{}" chmod g+w "{}"
chmod -R o-w wily
chmod -R o+w wily/logs
find wily -perm -u+x | xargs -I "{}" chmod go+x "{}"
fi
fi