Filemod

From GoBlueMich Wiki
Jump to navigation Jump to search

Filemod

  • Create script
touch /root/bin/filemod.sh
chmod 700 /root/bin/filemod.sh
vim /root/bin/filemod.sh
  • Script Contents
#!/bin/bash
COLUMNS=512
SUBJECT="Files Modified in the last 24hrs on $HOSTNAME "
EMAILMESSAGE="/tmp/emailmsg.txt"


	find /home/*/public_html/ -type f -mtime -1 -print > $EMAILMESSAGE

	#email (optional, set email address to customer and uncomment below lines)
	EMAIL="marko@hookah.ee"
	/bin/mail -s "$SUBJECT" "$EMAIL" < $EMAILMESSAGE
	
fi


  • Echo to crontab
echo "0 8 * * * /root/bin/filemod.sh > /dev/null 2>&1" >> /var/spool/cron/root