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!
Recent comments
1 day 8 hours ago
1 day 13 hours ago
1 day 17 hours ago
1 day 19 hours ago
2 days 9 hours ago
2 days 9 hours ago
2 days 14 hours ago
2 days 21 hours ago
2 days 22 hours ago
2 days 23 hours ago