Real-world example (ugly but works):
letsencrypt -tn --apache renew | tee "$LOG_FILE"
if ! grep -q '^No renewals were attempted.$' "$LOG_FILE"; then
CERTIFICATES_PATH='/etc/letsencrypt/live/example.com'
RENEWAL_STATUS=`sed -nr 's#^ '"$CERTIFICATES_PATH"'/fullchain.pem
\((.*)\)$#\1#p' "$LOG_FILE"`
if [[ "$RENEWAL_STATUS" == 'success' ]]; then
[...]
elif [[ "$RENEWAL_STATUS" == 'skipped' ]]; then
echo "$CERTIFICATES_PATH not renewed, not propagating."
else
echo "ERROR: Unknown renewal status of $CERTIFICATES_PATH:
$RENEWAL_STATUS" >&2
fi
fi
--
With Best Regards,
Marat Khalili