From efca1ec049822e56a63fb6c772863694c3267756 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Tue, 16 Feb 2021 16:13:41 +0100 Subject: global-functions: drop $MailServerIsUp Now that we have an e-mail queue we do not care if the server is up or not. --- global-functions | 47 ----------------------------------------------- 1 file changed, 47 deletions(-) (limited to 'global-functions') diff --git a/global-functions b/global-functions index 889dcea..8f4795d 100644 --- a/global-functions +++ b/global-functions @@ -32,7 +32,6 @@ :global IfThenElse; :global IPCalc; :global LogPrintExit; -:global MailServerIsUp; :global MkDir; :global ParseKeyValueStore; :global RandomDelay; @@ -486,52 +485,6 @@ } } -# check if mail server is up -:set MailServerIsUp do={ - :local MailServer [ / tool e-mail get address ]; - - :global EmailGeneralTo; - - :global LogPrintExit; - - :if ([ :len $EmailGeneralTo ] = 0) do={ - :return true; - } else={ - :if ($MailServer = "0.0.0.0") do={ - $LogPrintExit info ("No mail server is configured! Returning gracefully...") false; - :return true; - } - } - - :if ([ :len [ / tool netwatch find where comment=$MailServer ] ] = 0) do={ - $LogPrintExit info ("Adding netwatch entry for mail server.") false; - :local MailHost $MailServer; - :if ([ :typeof [ :toip $MailHost ] ] != "ip" ) do={ - :do { - :set MailHost [ :resolve $MailServer ]; - } on-error={ - $LogPrintExit warning ("Resolving mail server failed.") false; - :return false; - } - } - / tool netwatch add comment=$MailServer host=$MailHost; - } - - :local NetWatch [ / tool netwatch find where comment=$MailServer ]; - :local NetWatchVal [ / tool netwatch get $NetWatch ]; - :if ($NetWatchVal->"status" = "up") do={ - :return true; - } - - / tool netwatch set interval=($NetWatchVal->"interval") $NetWatch; - :delay ($NetWatchVal->"timeout"); - :if ([ / tool netwatch get $NetWatch status ] = "up") do={ - :return true; - } - - :return false; -} - # create directory :set MkDir do={ :local Dir [ :tostr $1 ]; -- cgit v1.2.3-54-g00ecf