I have written a little one liner that will email me when a list of files changes - I used sha512 to generate a list of hashes and then periodically check that those hashes still match.
*/5 * * * * /usr/bin/sha512sum --status -c /sha512.sumlist && echo "Success" > /dev/null || echo "Check robots.txt and index.html in /var/www as staging sites are now potentially exposed to the world and the damned googlebot" | /usr/bin/mail -s "Default staging server files have changed"
[email protected]
It works fine on the command line with:
/usr/bin/sha512sum --status -c /sha512.sumlist && echo "Success" > /dev/null || echo "Check robots.txt and index.html in /var/www as staging sites are now potentially exposed to the world and the damned googlebot" | /usr/bin/mail -s "Default staging server files have changed"
[email protected]
As soon as I run it as a cronjob though it emails every time it runs with the failure message instead of only when the sha512sum check should fail.
Is there something silly I have missed in a rush?
I forgot to mention that I am running an Ubuntu machine.