Created
March 3, 2018 10:31
-
-
Save justdave/c733d449324d0922d92d654ee484267a to your computer and use it in GitHub Desktop.
Zimbra 8.8.5 seems to freeze up on me periodically. I wrote this script to automatically kick it when it happens to avoid getting calls from users at odd hours complaining that they couldn't check their mail.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Script to automatically restart mailboxd when IMAP mailboxes fail to lock | |
# (which usually indicates the server has hung) | |
# | |
# Configure MAILTO to match where you want the notification email sent. | |
# | |
# Prerequisite: You must install LogWarn, which can be found at | |
# https://github.com/archiecobbs/logwarn if your package manager doesn't have | |
# it. | |
MAILTO="nobody@nowhere.tld" | |
ZMHOSTNAME=`/opt/zimbra/bin/zmhostname` | |
MESSAGE="To: $MAILTO | |
From: Zimbra on $ZMHOSTNAME <zimbra@${ZMHOSTNAME}> | |
Subject: Mailboxd restarted | |
Mailboxd restarted due to imap lock failures | |
" | |
LOGWARN=`/usr/bin/logwarn -d /opt/zimbra/log -p /opt/zimbra/log/mailbox.log 'Failed to lock mailbox'` | |
if [ -n "$LOGWARN" ]; then | |
/opt/zimbra/bin/zmmailboxdctl restart | |
echo "$MESSAGE" | /opt/zimbra/common/sbin/sendmail $MAILTO | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment