From f334b8d66e728dc849e8a4957345709cdce00393 Mon Sep 17 00:00:00 2001 From: Tristan Ancelet Date: Sat, 18 Nov 2023 18:59:58 -0600 Subject: [PATCH] Had to setup hostname calls in do_emergency_email so that the default value of MESSAGE woudln't have to be manually altered --- check-postfix.sh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/check-postfix.sh b/check-postfix.sh index 8297af4..3f793be 100755 --- a/check-postfix.sh +++ b/check-postfix.sh @@ -30,13 +30,11 @@ send_email () { The only option is to manually telnet to the smtp port on the authoritative mailserver for the target domain. As otherwise unless a mail-host is configured as an email relay, you will be unable to send an email to a user outside of the mailservers domain (without authentication). " do_emergency_email () { - local MESSAGE="${1:-"The Postfix service has failed to come up on tartarus (192.168.3.2) after a service restart. Please ssh into server to troubleshoot the issues."}" - + local MESSAGE="${1:-"The Postfix service has failed to come up on `hostname` (`hostname -i`) after a service restart. Please ssh into server to troubleshoot the issues."}" ## Getting a mailserver IP for manual message MAILSERVER=`dig $DOMAIN mx | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+' | head -n 1` - ## Setting up coprocess to send commands to telnet session - coproc TELNET { telnet $MAILSERVER 25; } + ## Setting up coprocess to send commands to telnet session coproc TELNET { telnet $MAILSERVER 25; } ## Commands to send email manually local -a commands=(