Hi
I have below shell script to send mail alert , however I want to add more functionality in this script and that is , script should only check that file between 9 am to 5pm , and if there is no activity in this time 9 am to 5 pm for 2hours then it should give me mail alert, please help
filename="abc.txt"
echo "Filename is $filename"
MTIME=$(find "$filename" -mmin +10)
if [ -z "$MTIME" ]
then echo "$filename not modified in last 10 minutes. Please check"
mail -s "$filename not modified" abc.xxx@com
else echo "$filename is modified"
fi
When should that script run, and how do you plan to do that? Every two hours, from 11:00h in the morning (looking 2 hours back) until 17:00h? Is cron an option?