Go to:  Davar site entry | Site contents | Site index | Client/Server | MQSeries | Text bottom

SETMQAUT  Korn  Script

SETMQAUT script sets and/or displays authorizations of the Queue Manager objects, names of which are coded into the script.  The script below presents patterns of several possible ways to list objects for standard +allmqi settings with the addition of specialized settings.  Different colors are used to highlight different object[/authority] listing patterns in the script text.

Real-life authorization setup script is Queue Manager specific, so it makes sense to name the actual script by the name of the Queue Manager, TESTQMGR in this example.

Demo of SETMQAUT script operation can be found below the script text.



# /var/mqm/aut/TESTQMGR  Set MQS Object Authorizations     08/16/200102/26/2002
# ------------------------------------------------------------------------------
# Copyright (C) 20012002 by Vladimir Veytsel                      www.davar.net

# 1. Script execution mode parameter (optional):

#    "S" or "s"      value causes authorizations to be SET only;
#    other non-empty value causes authorizations to be SET & displayed;
# -            empty value causes authorizations to be only  displayed.

# Dbg=echo  # Uncomment for debugging

  MQM=TESTQMGR

  U=$(id | cut -f2 -d'(' | cut -f1 -d')')

  if [[ $U = root || $U = mqm ]]

     then Users="user1 user2"

#                 Keep queue names sorted to simplify maintenance
          Queues=
          Queues="$Queues TRANS.DATA"
          Queues="$Queues TRANS.REPLY"
          Queues="$Queues TRANS.TRACE"

          for N in 1 2
              do
                 Queues="$Queues TEST$N.DATA"
                 Queues="$Queues TEST$N.REPLY"
                 Queues="$Queues TEST$N.TRACE"
              done

          for T in DEMO REAL
              do for N in 1 2
                     do
                        Queues="$Queues $T$N.DATA"
                        Queues="$Queues $T$N.REPLY"
                        Queues="$Queues $T$N.TRACE"
                     done
              done

          cd /usr/bin

          if [ $1. != . ]
             then for User in $Users
                      do $Dbg setmqaut -m $MQM -p $User -t qmgr +allmqi
                         $Dbg setmqaut -m $MQM -p $User -t queue -n SYSTEM.DEAD.LETTER.QUEUE +browse
                         for Queue in $Queues
                             do $Dbg setmqaut -m $MQM -p $User -t queue -n $Queue +allmqi
                             done
                      done
                  $Dbg setmqaut -m $MQM -p user1 -t queue -n USER.DEAD.LETTER.QUEUE +get
                  $Dbg setmqaut -m $MQM -p user2 -t queue -n USER.DEAD.LETTER.QUEUE +browse
          fi

          if [ $(echo $1 | tr "[:upper:]" "[:lower:]"). != s. ]
             then for User in $Users
                      do $Dbg dspmqaut -m $MQM -p $User -t qmgr
                         $Dbg dspmqaut -m $MQM -p $User -t queue -n SYSTEM.DEAD.LETTER.QUEUE
                         for Queue in $Queues
                             do $Dbg dspmqaut -m $MQM -p $User -t queue -n $Queue
                             done
                      done
                  $Dbg dspmqaut -m $MQM -p user1 -t queue -n USER.DEAD.LETTER.QUEUE
                  $Dbg dspmqaut -m $MQM -p user2 -t queue -n USER.DEAD.LETTER.QUEUE
          fi

     else echo Sorry, $MQM object authorization setup script requires
          echo root or mqm authority for execution, but you are $User.
          id
  fi
  


Below there is a log of debugging execution of the SETMQAUT script (renamed into TESTQMGR by the name of the Queue Manager for which it was developed).  For the debugging execution line Dbg=echo was temporarily uncommented, which caused each setmqaut command with all its parameters substituted to be echo-ed instead of being executed.



   # TESTQMGR s
   setmqaut -m TESTQMGR -p user1 -t qmgr +allmqi
   setmqaut -m TESTQMGR -p user1 -t queue -n SYSTEM.DEAD.LETTER.QUEUE +browse
   setmqaut -m TESTQMGR -p user1 -t queue -n TRANS.DATA +allmqi
   setmqaut -m TESTQMGR -p user1 -t queue -n TRANS.REPLY +allmqi
   setmqaut -m TESTQMGR -p user1 -t queue -n TRANS.TRACE +allmqi
   setmqaut -m TESTQMGR -p user1 -t queue -n TEST1.DATA +allmqi
   setmqaut -m TESTQMGR -p user1 -t queue -n TEST1.REPLY +allmqi
   setmqaut -m TESTQMGR -p user1 -t queue -n TEST1.TRACE +allmqi
   setmqaut -m TESTQMGR -p user1 -t queue -n TEST2.DATA +allmqi
   setmqaut -m TESTQMGR -p user1 -t queue -n TEST2.REPLY +allmqi
   setmqaut -m TESTQMGR -p user1 -t queue -n TEST2.TRACE +allmqi
   setmqaut -m TESTQMGR -p user1 -t queue -n DEMO1.DATA +allmqi
   setmqaut -m TESTQMGR -p user1 -t queue -n DEMO1.REPLY +allmqi
   setmqaut -m TESTQMGR -p user1 -t queue -n DEMO1.TRACE +allmqi
   setmqaut -m TESTQMGR -p user1 -t queue -n DEMO2.DATA +allmqi
   setmqaut -m TESTQMGR -p user1 -t queue -n DEMO2.REPLY +allmqi
   setmqaut -m TESTQMGR -p user1 -t queue -n DEMO2.TRACE +allmqi
   setmqaut -m TESTQMGR -p user1 -t queue -n REAL1.DATA +allmqi
   setmqaut -m TESTQMGR -p user1 -t queue -n REAL1.REPLY +allmqi
   setmqaut -m TESTQMGR -p user1 -t queue -n REAL1.TRACE +allmqi
   setmqaut -m TESTQMGR -p user1 -t queue -n REAL2.DATA +allmqi
   setmqaut -m TESTQMGR -p user1 -t queue -n REAL2.REPLY +allmqi
   setmqaut -m TESTQMGR -p user1 -t queue -n REAL2.TRACE +allmqi
   setmqaut -m TESTQMGR -p user2 -t qmgr +allmqi
   setmqaut -m TESTQMGR -p user2 -t queue -n SYSTEM.DEAD.LETTER.QUEUE +browse
   setmqaut -m TESTQMGR -p user2 -t queue -n TRANS.DATA +allmqi
   setmqaut -m TESTQMGR -p user2 -t queue -n TRANS.REPLY +allmqi
   setmqaut -m TESTQMGR -p user2 -t queue -n TRANS.TRACE +allmqi
   setmqaut -m TESTQMGR -p user2 -t queue -n TEST1.DATA +allmqi
   setmqaut -m TESTQMGR -p user2 -t queue -n TEST1.REPLY +allmqi
   setmqaut -m TESTQMGR -p user2 -t queue -n TEST1.TRACE +allmqi
   setmqaut -m TESTQMGR -p user2 -t queue -n TEST2.DATA +allmqi
   setmqaut -m TESTQMGR -p user2 -t queue -n TEST2.REPLY +allmqi
   setmqaut -m TESTQMGR -p user2 -t queue -n TEST2.TRACE +allmqi
   setmqaut -m TESTQMGR -p user2 -t queue -n DEMO1.DATA +allmqi
   setmqaut -m TESTQMGR -p user2 -t queue -n DEMO1.REPLY +allmqi
   setmqaut -m TESTQMGR -p user2 -t queue -n DEMO1.TRACE +allmqi
   setmqaut -m TESTQMGR -p user2 -t queue -n DEMO2.DATA +allmqi
   setmqaut -m TESTQMGR -p user2 -t queue -n DEMO2.REPLY +allmqi
   setmqaut -m TESTQMGR -p user2 -t queue -n DEMO2.TRACE +allmqi
   setmqaut -m TESTQMGR -p user2 -t queue -n REAL1.DATA +allmqi
   setmqaut -m TESTQMGR -p user2 -t queue -n REAL1.REPLY +allmqi
   setmqaut -m TESTQMGR -p user2 -t queue -n REAL1.TRACE +allmqi
   setmqaut -m TESTQMGR -p user2 -t queue -n REAL2.DATA +allmqi
   setmqaut -m TESTQMGR -p user2 -t queue -n REAL2.REPLY +allmqi
   setmqaut -m TESTQMGR -p user2 -t queue -n REAL2.TRACE +allmqi
   setmqaut -m TESTQMGR -p user1 -t queue -n USER.DEAD.LETTER.QUEUE +get
   setmqaut -m TESTQMGR -p user2 -t queue -n USER.DEAD.LETTER.QUEUE +browse

# alog "Feb 26"
--- /var/mqm/adm/runmqadm.log Lines from Feb 26 to Log End ---
[11628] user1            Mon Feb 26 10:16:49 2001 1
** Started runmqadm session **
[11628] user1            Mon Feb 26 10:16:49 2001 1
   runmqsc QUEUEMGR
[11628] user1            Mon Feb 26 10:16:49 2001 1
   display qmgr
.  .  .  .  .

          
        


View [and save] SETMQAUT text   (Use [Back] button or [Alt]+[CL] to return here)
Go to:  Davar site entry | Site contents | Site index | Client/Server | MQSeries | Text top