#!/bin/bash
RYD=/share
FILESPEC=*.sh
DIRPERM=700
FILEPERM=750
OWNER=user:group
CH_FSPEC=0
if [ -d $RYD ]; then
find $RYD -type d | xargs chmod $DIRPERM
if [ $CH_FSPEC -gt 0 ]; then
find $RYD -type f | xargs chmod $FILEPERM
else
find $RYD -type f | grep -v "$FILESPEC" | xargs chmod $FILEPERM
fi
chown -R $OWNER $RYD
for SCRIPT in $RYD/$FILESPEC; do
if [ -x $SCRIPT ]; then
echo "Executing : $SCRIPT"
. $SCRIPT
fi
done
else
echo "ERROR! The directory doesn't exist."
exit 1
fi
exit 0