Skip to content

Instantly share code, notes, and snippets.

@leblanc-simon
Created February 8, 2014 01:02
Show Gist options
  • Save leblanc-simon/8875057 to your computer and use it in GitHub Desktop.
Save leblanc-simon/8875057 to your computer and use it in GitHub Desktop.
#!/bin/bash
directory="/var/www/"
result="${directory}website-integrity/`date '+%Y-%m-%d'`.md5sum"
old_result="${directory}website-integrity/`date '+%Y-%m-%d' --date '1 days ago'`.md5sum"
website_directory="${directory}httpdocs/"
find ${website_directory} -type f -exec md5sum {} \; > ${result}
today=`md5sum ${result} | awk '{print $1}'`
yesterday=`md5sum ${old_result} | awk '{print $1}'`
if [ "${today}" != "${yesterday}" ]; then
echo "Bad luck"
echo "Il y a une difference entre le site d'hier et celui d'aujourd'hui : voir ${result} et ${old_result}" | mail -s "hack potentiel" admin@example.org
exit 1
else
echo "Yeah !"
exit 0
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment