[ZIMBRA] Zimbra installation integrity check - fourslickz/notes GitHub Wiki

#!/bin/bash

DIR='/tmp'
mkdir $DIR/CHECKSUMS
dt=`date +'%m-%d-%Y-%T'`
HN=`hostname`

echo "Fetching folders to search.."
/bin/ls -la /opt/zimbra/ | awk '{print $9}' | egrep -v 'backup|log|db|index|store|data|zmstat' | sed '1,3d' > $DIR/CHECKSUMS/zimdir

echo "Creating file list.."
for i in `cat $DIR/CHECKSUMS/zimdir`
do
find /opt/zimbra/"$i" -mount -type f | egrep -v "/opt/zimbra/backup/|/opt/zimbra/data/|/opt/zimbra/zmstat/" >> $DIR/CHECKSUMS/sha1files_"$HN"_"$dt".txt
done
sed -i 's/^/"/ ; s/$/"/' $DIR/CHECKSUMS/sha1files_"$HN"_"$dt".txt

echo "Calculating checksums.. (This can take time)"

cat $DIR/CHECKSUMS/sha1files_"$HN"_"$dt".txt | tee -a /tmp/asdf.log | xargs sha1sum  >> $DIR/CHECKSUMS/sha1sum_zimbra_"$HN"_"$dt".log
echo "Done"

exit

chmod +x /usr/local/sbin/zimbra-checksums
/usr/local/sbin/zimbra-checksums

cat /tmp/CHECKSUMS/sha1sum_zimbra_zimbra10.example.com_10-11-2022-08\:44\:06.log | sort -k2 > /tmp/resultY
cat /tmp/CHECKSUMS/sha1sum_zimbra_zimbra10.example.com_10-10-2022-13\:21\:01.log | sort -k2 > /tmp/resultX
diff -Naur /tmp/resultX /tmp/resultY