I need help with a shell script, maybe someone can help me out. For example lets say I have a list.conf file with a list of directories in it: usr/bin /ect and I must create an A1.sh file that reads the directories in the list.conf file and then scan those directories for any file that has been modified in the last day. If the file has been modified the shell script would send an email to an address with the directory or file that has been modified in the last day.
I know I must use the find command with -mtime +1 for the search, but I have no clue how to read the directories from the list.conf file or the proper syntax of the if statement to send an email with the list of modified files.
Please bare with me since I am very new to shell scripts...
any help would be greatly appreciated. Thanks in advanced.
while read dir
find $dir -mtime -1 | xargs ls -l > /tmp/$$
if [ -s /tmp/$$ ] ; then
echo "Directory : $dir"
echo "The following directories or files have been modified"
echo "during the last 24 hours."
} | mail -s "Modified files" user
done < list.conf
rm -f /tmp/$$