Dovecot Failed state

As mentioned in a different topic, we suffer from the same issues: Dovecot Left in mixed failed state after LetsEncrypt gets a new cert

In order to somewhat mitigate the downtime I’ve created a script that runs every 5 minutes as a cronjob:

#!/bin/bash
# This script tries to recover dovecot when it was unable to restart itself
# https://forum.virtualmin.com/t/dovecot-left-in-mixed-failed-state-after-letsencrypt-gets-a-new-cert/106125/6
# https://forum.virtualmin.com/t/dovecot-failed-state/105718/73

pgrep -fx dovecot/imap > /dev/null

if [ "$?" -ne 0 ]; then
    echo "Dovecot is not running, starting dovecot..."
    systemctl start dovecot
fi

We’ll be using this to keep our uptime while a proper fix is being worked on.

Use script at own risk.