Added a section documenting the script

This commit is contained in:
Tristan Ancelet 2023-11-18 19:13:31 -06:00
parent 0911f7b134
commit 4e5967e3bc

View File

@ -1,5 +1,33 @@
#!/usr/bin/bash #!/usr/bin/bash
#############################################################################################################
# check-postfix.sh #
#############################################################################################################
# #
# This script is just something I cooked up for work. I setup a server with posftix configured as an` #
# email/smtp relay so that some of our old equipment can still function without having to try and #
# configure our commercial Email Server to accept unauthed requests to send email. #
# #
# This requres a few packages to be installed: #
# - postfix (of course) #
# - telnet #
# - sendmail #
# #
# The issue is if the postfix service dies and fails to come back up after a restart via this script, #
# you will be unable to send any emails via a smtp client (as they will try to contact the service #
# on the server itself). So the only workaround I was able to find is to manually send the email via #
# telnet using a coproc. You could use a smtp library with python or perl, but I like to keep these #
# scripts using a single language wherever possible. #
# #
# Since telnet is just a basic tcp client we are able to interact with the smpt port on a mailserver #
# (port 25). So setting it up as coproc allows us to run a concurrent process and pipe commands into #
# the file-descriptor to send the commands to the mailserver. Which allows us to manually send an email #
# to an authoritative email server (provided they don't have your IP blocklisted or are filtering #
# traffic on port 25). #
# #
#############################################################################################################
# BEGIN: Variables # BEGIN: Variables
## Duration to wait to see if service has come back up ## Duration to wait to see if service has come back up
DURATION=10 DURATION=10