#!/bin/bash
#		       /usr/local/bin/rsnapshot-pre-exec invoked by				   /etc/rsnapshot.conf
# http://crystalfaeries.net/posix/bin/rsnapshot-pre-exec invoked by http://crystalfaeries.net/posix/etc/rsnapshot.conf
# celeste:crystalfaery 2015-05-22 17:36:27+00:00 include hostname in e-mail notice
# celeste:crystalfaery 2015-02-18 04:00:25+00:00 not backup /boot/lost+found
# celeste:crystalfaery 2014-12-12 10:01:19+00:00 detecting Turla
# celeste:crystalfaery 2014-10-02 12:22:34+00:00 early rsnapshot pre-exec version

cd /root >> /var/log/rsnapshot.log 2>&1
echo 'sha256sum /boot/* turla*'							>> /var/log/rsnapshot.log 2>&1

# BOOT	components:
mv /rescue/checksums.txt /rescue/checksums.txt-					2>> /var/log/rsnapshot.log
/usr/bin/find /boot -type f -exec sha256sum {} \; | sort	>  /rescue/checksums.txt 2>> /var/log/rsnapshot.log

# Turla	components:
/usr/bin/sha256sum /usr/bin/openssl				>> /rescue/checksums.txt 2>> /var/log/rsnapshot.log
/usr/bin/sha256sum /usr/lib/i386-linux-gnu/libpcap.so.0.8	>> /rescue/checksums.txt 2>> /var/log/rsnapshot.log
/usr/bin/sha256sum /usr/lib/i386-linux-gnu/libpcap.so.1.3.0	>> /rescue/checksums.txt 2>> /var/log/rsnapshot.log
/usr/bin/sha256sum /usr/sbin/tcpdump				>> /rescue/checksums.txt 2>> /var/log/rsnapshot.log
/usr/bin/sha256sum /usr/share/aclocal/glibc2.m4			>> /rescue/checksums.txt 2>> /var/log/rsnapshot.log
/usr/bin/sha256sum /usr/share/aclocal/glibc21.m4		>> /rescue/checksums.txt 2>> /var/log/rsnapshot.log

echo /usr/bin/diff /rescue/checksums.txt- /rescue/checksums.txt		 	>> /var/log/rsnapshot.log 2>&1
# Report Changes
/usr/bin/diff	/rescue/checksums.txt- /rescue/checksums.txt		 	>> /var/log/rsnapshot.log 2>&1 \
&& /usr/bin/rsync -auvzH --exclude=lost+found /boot/* /rescue			>> /var/log/rsnapshot.log 2>&1 \
|| /usr/bin/tail /var/log/rsnapshot.log | /usr/bin/mail -s "`hostname`: /boot CHANGED; /rescue UNCHANGED." root



syntax highlighted by Code2HTML, v. 0.9.1