From 9ec8b7bec17c2a01a62b8da4edd70f96be4b0de0 Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Fri, 4 Mar 2022 20:18:07 -0600 Subject: [PATCH] Update install-dsmon.sh --- install-dsmon.sh | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/install-dsmon.sh b/install-dsmon.sh index e7d7172..b2701b4 100755 --- a/install-dsmon.sh +++ b/install-dsmon.sh @@ -43,14 +43,26 @@ if [ "${SET_THRESHOLD}" = "" ]; then fi echo -e "${idsCL[Yellow]}Sending test Alert... ${idsCL[Default]}" -echo "Test Alert" | mail -r DSMon-$(hostname -s)@scity.us -s "Test" $SET_ALERTEMAIL +echo "Test Alert" | mail -r DSMon_$(hostname -s)@scity.us -s "Test" $SET_ALERTEMAIL echo -e "${idsCL[Yellow]}Adding task to crontab... ${idsCL[Default]}" (crontab -l ; echo "0 */3 * * * /usr/local/bin/dsmon")| crontab - echo -e "THRESHOLD=$SET_THRESHOLD ALERT_EMAIL=$SET_ALERTEMAIL -" > /opt/idssys/settings/dsmon.conf +" > /opt/idssys/dsmon/settings.conf + +echo -e "echo \"*Restarting Zimbra*\" >> /opt/idssys/dsmon/diskspace.log +mail -r DSMon-\$(hostname -s)@scity.us -s 'Disk Space Alert' \$ALERT_EMAIL << EOF +Your root partition remaining free space is running low. Used: $CURRENT% +Restarting Zimbra +EOF +date=\$(date '+%Y-%m-%d') +/usr/bin/sudo -iu zimbra zmcontrol stop +/bin/gzip /opt/zimbra/log/mailbox.log => /opt/zimbra/log/mailbox.log.\$date.gz +/bin/rm -f /opt/zimbra/log/mailbox.log +/usr/bin/sudo -iu zimbra zmcontrol start +" > /opt/idssys/dsmon/actions.conf echo ""