github.com/mackerelio/mackerel-agent-plugins@v0.89.3/mackerel-plugin-mailq/lib/fixtures/postqueue (about)

     1  #!/bin/bash
     2  
     3  # This script generates a dummy queue information in the format of Postfix postqueue
     4  
     5  [[ $1 != -p ]] && exit 1
     6  
     7  TEST_MAILQ_COUNT=${TEST_MAILQ_COUNT:-0}
     8  POSTQUEUE_REQUEST_LABEL="Requests"
     9  
    10  if [[ $TEST_MAILQ_COUNT -eq 1 ]]; then
    11      POSTQUEUE_REQUEST_LABEL="Request"
    12  fi
    13  
    14  if [[ $TEST_MAILQ_COUNT -ne 0 ]]; then
    15      cat <<EOF
    16  -Queue ID- --Size-- ----Arrival Time---- -Sender/Recipient-------
    17  EOF
    18      for i in $(seq 1 "$TEST_MAILQ_COUNT"); do
    19          cat <<EOF
    20  DD0C740001C      274 Thu Mar  3 23:52:37  foobar@example.com
    21            (connect to mail.invalid[192.0.2.100]:25: Connection timed out)
    22                                           nyao@mail.invalid
    23  
    24  EOF
    25      done
    26      cat <<EOF
    27  -- 15 Kbytes in ${TEST_MAILQ_COUNT} ${POSTQUEUE_REQUEST_LABEL}.
    28  EOF
    29  else
    30      cat <<EOF
    31  Mail queue is empty
    32  EOF
    33  fi