Browse Source

Update 'groupwise.sh'

Added more debug routines to the gwMTA routine.
Michael Honkoop 1 year ago
parent
commit
922459c88d
1 changed files with 17 additions and 5 deletions
  1. 17 5
      groupwise.sh

+ 17 - 5
groupwise.sh

@@ -4,13 +4,13 @@
 # Global definitions for the script - change to fit your needs #
 ################################################################
 
-# process to look for if a GroupWise MailTransferAgent (MTA) is running (leave blank if no MTA is on the client)
+# process to look for if a GroupWise MailTransferAgent (MTA) is running (0 if no MTA is on the client, else set 1)
 gwMTA=1
 
-# process to look for if a GroupWise PostOffice (POA) is running (leave blank if no POA is on the client)
+# process to look for if a GroupWise PostOffice (POA) is running (0 if no POA is on the client, else set 1)
 gwPOA=1
 
-# process to look for if a GroupWise Internet Agent (GWIA) is running (leave blank if no GWIA is on the client)
+# process to look for if a GroupWise Internet Agent (GWIA) is running (0 if no GWIA is on the client, else set 1)
 gwIA=1
 
 # Debug switch for development purposes ( 0 for no debug, 1 for debug information )
@@ -34,17 +34,29 @@ then
     then
         if [ $debug -eq 1 ]
         then
-            echo "DEBUG: gwMTA is enabled and we found a process ID: $gwMTAProcess"
+            echo "DEBUG:We found a gwMTA process ID: $gwMTAProcess"
         fi
         gwMTAListener=$(ss -lpn | grep $gwMTAProcess |awk '{print $5}' | grep -E '^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}'| sed -E ':a;N;$!ba;s/\r{0,1}\n/\\n/g') 
         if [ ! -z "$gwMTAListener" ]
         then
+            if [ $debug -eq 1 ]
+            then
+                echo "DEBUG:We found atleast one gwMTA listener: $gwMTAListener"
+            fi
             echo "P \"Groupwise MTA\" status=1;;;1 GroupWise Mail Transfer Agent is running with PID: $gwMTAProcess and listening.\n $gwMTAListener"
         else
+            if [ $debug -eq 1 ]
+            then
+                echo "DEBUG:We found no listeners for the gwMTA process with process ID: $gwMTAProcess"
+            fi
             echo "P \"Groupwise MTA\" status=0.5;;;1GroupWise Mail Transfer Agent is running with PID: $gwMTAProcess but not listening."
         fi
     else
-         echo "P \"GroupWise MTA\" status=0;;;1 GroupWise Mail Transfer Agemt process is not Running."
+        if [ $debug -eq 1 ]
+        then
+            echo "DEBUG: gwMTA is enabled in config, but no processes could be found."
+        fi
+        echo "P \"GroupWise MTA\" status=0;;;1 GroupWise Mail Transfer Agemt process is not Running."
     fi
 fi