I am look for a bash script that will check if a file has been modified in the last hour and email an alert if it has been modified. This script will be used in Solaris and Ubuntu. I am sure it's not hard, but I am not a Linux admin. Can someone please help?
Windows file propertiesRight-click the file and select Properties. In the Properties window, the Created date, Modified date, and Accessed date is displayed, similar to the example below.
modification date does NOT change on open or close.
How about this?
#!/bin/bash
[[ -z `find /home/spatel/ -mmin -60` ]]
if [ $? -eq 0 ]
then
echo -e "nothing has changed"
else
mail -s "file has been changed" [email protected]
fi
Put this script in hourly cron job
01 * * * * /path/to/myscript
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With