#!/bin/bash -e cd /etc/ [ -d letsencrypt~ ] \ && diff -rq letsencrypt/ letsencrypt~/ \ && exit 0 F=`date "+%Y%m%d"`.tar.gz ( echo "Subject: New /etc/letsencrypt/ on Droplet." echo "" ( echo "Content-Type: multipart/mixed; boundary=\"boundary\"" echo "MIME-Version: 1.0" echo "" echo "--boundary" echo "Content-Type: application/gzip; name=\"$F\"" echo "Content-Disposition: attachment; filename=\"$F\"" echo "Content-Transfer-Encoding: base64" echo "" tar czf - letsencrypt/ | base64 echo "" echo "--boundary--" ) \ | gpg --encrypt --armor \ --trust-model always --recipient root@core ) \ | sendmail root \ || exit $? rm -rf letsencrypt~ cp -a letsencrypt letsencrypt~