Not sending mail without returns

Homepage Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Not sending mail without returns

  • Creator
    Topic
  • #49156
    Hongle Sun
    Participant

    Hello, I would like to prevent Cloverf/AIX from sending me mails if

    my script “hciconnstatus | sed -e ‘/up/d’ | mail -s ‘following threads not up!’ mymail@mayaddress.com” have not return, means if all my thread all are up and running and i dont want mail/get alerted, how can i do that, thanks.

Viewing 0 reply threads
  • Author
    Replies
    • #60921
      David Dillard
      Participant

      HI,

      Here is a script I used to e-mail the status of the processes and connections on the engine.  It only sends mail if a process or connection is dead or down.

      I had this run as an hourly report from a cron job.

      It should give you a place to start:

      Code:

      #!/bin/ksh
      ###########################################################################################
      # File:  mailenginestatus.sh
      #
      # Author:  David D Dillard
      #
      # Description:  This script is used check the process and connection status of the
      #               QDX engine and send a mail to the notification group with the status
      #               information
      #        18jan2005-ddd modified to only send mail if nothing is dead or down
      #
      ###########################################################################################
      site=”live”
      sitepath=”/quovadx/integrator/liveroot”
      # If script is not running in the site this will swap into the correct site
      #   Edit to add whatever scripts you use to swap to your site
      if [[ $HCISITE != $site ]]; then
             setroot $sitepath $site >> mailenginestatus.log 2>&1
             cdsite
      fi

      #now that we are in the correct site we can proceed
      mailto=”enginesupport@company.com”
      subject=”QDX alert message: Status report for the $site interface engine site”
      echo “QDX engine status report for the $site site” > mailenginestatus.log
      date >> mailenginestatus.log
      echo “nn————————————————————————-” >> mailenginestatus.log
      echo “The following processes are dead” >> mailenginestatus.log
      hciprocstatus | grep dead >> mailenginestatus.log
      echo “nThe following connections are down” >> mailenginestatus.log
      hciconnstatus | grep down >> mailenginestatus.log
      echo “nn————————————————————————-” >> mailenginestatus.log
      echo “Complete hciprocstatus report:” >> mailenginestatus.log
      hciprocstatus >> mailenginestatus.log
      echo “nn————————————————————————-” >> mailenginestatus.log
      echo “Complete hciconnstatus report:” >> mailenginestatus.log
      hciconnstatus >> mailenginestatus.log

      tmp=”/tmp/livemailenginestatus.tmp.$RANDOM”            ;# Create random temp file
      hciprocstatus | grep dead >> $tmp 2>&1
      hciconnstatus | grep down >> $tmp 2>&1

      # search the status for any dead or down processes or connections
      if (grep -c “d” $tmp > /dev/null);
      then
          mail -s “$subject” $mailto < mailenginestatus.log
      fi
      sleep 2
      rm mailenginestatus.log
      rm $tmp

Viewing 0 reply threads
  • The forum ‘Cloverleaf’ is closed to new topics and replies.

Forum Statistics

Registered Users
5,117
Forums
28
Topics
9,292
Replies
34,435
Topic Tags
286
Empty Topic Tags
10