fix: updated diskalert smtp server

This commit is contained in:
Matthew McKinnon 2024-05-06 00:41:42 +10:00
parent 9a2d0f65f3
commit 735d661aa2
2 changed files with 1 additions and 52 deletions

View File

@ -8,7 +8,7 @@
MAILTO="support@comprofix.com"
MAILFROM="support@comprofix.com"
THISSERVER=$(hostname -f)
SMTP="mail.comprofix.com"
SMTP="comprofix-com.mail.protection.outlook.com"
LOGFILE="/var/log/diskalert.log"
THISSERVER=$(hostname -f)

View File

@ -1,51 +0,0 @@
#!/bin/bash
# Script Name: dbbackup
# Author: Matt McKinnon
# Date: 7th June 2016
# Description:
# This script will backup your mysql databases.
# Send an email report of databases that have been backed up.
# Rotate backups for 7 days
#
# NOTE:
# A user will need to be grated permissions on the databases
# Login to mysql with your root user.
#
# CREATE USER 'dbbackup'@'localhost' IDENTIFIED BY 'PASSWORD';
# GRANT LOCK TABLES, SELECT, SHOW VIEW, RELOAD, REPLICATION CLIENT, EVENT, TRIGGER ON *.* TO 'dbbackup'@'localhost';
MAILTO="support@comprofix.com"
MAILFROM="support@comprofix.com"
SMTP="comprofix-com.mail.protection.outlook.com"
BAKDATE=$(date +%Y%m%d)
SUBJECT="Docker data backup completed - $BAKDATE"
BACKUPDIR='/mnt/nfs/archive/dockerdata/'
LOG="/tmp/dockerdata-backup.log"
MESSAGE="/tmp/message.log"
touch $LOG
touch $MESSAGE
rotate_backups() {
find $BACKUPDIR -type f -mtime +7 -exec rm -frv {} \;
}
rotate_backups
folders=$(find /mnt/nfs/docker/ -maxdepth 1 -mindepth 1 -type d)
for folder in $folders; do
echo "Archiving $folder" >> $MESSAGE
tar -Pzcvf $BACKUPDIR/${folder##*/}-$BAKDATE.tar.gz $folder &>> $LOG
done
sendemail -o tls=yes -s $SMTP -t $MAILTO -f "$SQLSERVER <$MAILFROM>" -u "$SUBJECT" -m "$(cat $MESSAGE)" -a $LOG -q
#Use Below to use systems postfix or local MTA
#cat /tmp/backup.msg | mail -s "$SUBJECT" "$MAIL"
rm $MESSAGE
rm $LOG