Browse Source

Update 'groupwise.sh'

Added debug information to gwPOA routine.
Michael Honkoop 1 year ago
parent
commit
4963539c82
1 changed files with 19 additions and 4 deletions
  1. 19 4
      groupwise.sh

+ 19 - 4
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 (0 if no MTA is on the client, else set 1)
+# Look for a process if a GroupWise MailTransferAgent (MTA) should be 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 (0 if no POA is on the client, else set 1)
+# Look for a process if a GroupWise PostOffice (POA) should be 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 (0 if no GWIA is on the client, else set 1)
+# Look for a process if a GroupWise Internet Agent (GWIA) should be 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 )
@@ -69,15 +69,30 @@ then
     gwPOAProcess=$(ps -ef | grep "gwpoa" | grep -v grep | awk '{print $2}')
     if [ ! -z "$gwPOAProcess" ]
     then
+        if [ $debug -eq 1 ]
+        then
+            echo "DEBUG:We found a gwPOA process ID: $gwPOAProcess"
+        fi
         gwPOAListener=$(ss -lpn | grep $gwPOAProcess |awk '{print $5}' | grep -E '^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | sort -u | sed -E ':a;N;$!ba;s/\r{0,1}\n/\\n/g' )
         if [ ! -z "$gwPOAListener" ]
         then
+            if [ $debug -eq 1 ]
+                echo "DEBUG:We found atleast one gwPOA listener: $gwPOAListener"
+            fi
             echo "P \"Groupwise POA\" status=1;;;1 GroupWise Post Office Agent is running with PID: $gwPOAProcess and listening.\n $gwPOAListener"
         else
+            if [ $debug -eq 1 ]
+            then
+                echo "DEBUG:We found no listeners for the gwPOA process with process ID: $gwPOAProcess"
+            fi
             echo "P \"Groupwise POA\" status=0.5;;;1GroupWise Post Office Agent is running with PID: $gwPOAProcess but not listening."
         fi
     else
-         echo "P \"GroupWise POA\" status=0;;;1 GroupWise Post Office Agemt process is not Running."
+        if [ $debug -eq 1 ]
+        then
+            echo "DEBUG: gwPOA is enabled in config, but no processes could be found."
+        fi
+        echo "P \"GroupWise POA\" status=0;;;1 GroupWise Post Office Agemt process is not Running."
     fi
 fi