Hi,
I need to write a shell script that would:
-check if a specified directory exists and contains any files
-chmod and chown all files inside the directory
-execute all shell scripts in that directory (*.sh)
That script would be run by Cron using root account.
So far I came up with something like this:
Code:
#!/bin/bash
KATALOG=/var/scripts
if [ -d $katalog ]; then
chmod -R 700 /var/scripts
for SCRIPT in $katalog
do
if [ -f $SCRIPT -a -x $SCRIPT ]
then
$SCRIPT
fi
done
else
echo "ERROR! The directory doesn't exist."
exit 1
fi
Please help me in making it do what it's supposed to do.
Thanks in advance!