Had to setup hostname calls in do_emergency_email so that the default value of MESSAGE woudln't have to be manually altered

This commit is contained in:
Tristan Ancelet 2023-11-18 18:59:58 -06:00
parent 431918e013
commit f334b8d66e

View File

@ -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=(