Wrapper script for tibemsadmin command to prevent changes to a standby EMS server.

Wrapper script for tibemsadmin command to prevent changes to a standby EMS server.

book

Article ID: KB0085992

calendar_today

Updated On:

Products Versions
TIBCO Enterprise Message Service -
Not Applicable -

Description

Resolution:
Description:
=============
Automated way of preventing users from making changes using stand-by EMS server.  

Resolution:
==============
The following wrapper script can be used: tibemsadmin.sh for tibemsadmin command. It disconnects when connecting to a standby EMS server and operates normally when connecting to a primary EMS server:

=============
#!/bin/bash
#

FILE="./emsConn.$RANDOM.txt"
echo "exit" |./tibemsadmin "$@" > $FILE

grep -q "Connected to fault-tolerant standby server" $FILE if [ $? -eq 0 ]; then
    echo "Connected to standby server, exit."
    rm $FILE
    exit 0
fi
rm $FILE
exec ./tibemsadmin "$@"
==============

You can put this script in the same directory as the tibemsadmin command or within a different directory. Note that you will need to change the path to the tibemsadmin command. Make sure you can write a tmp file to current directory or change the script to write the temp file to another directory. You can run the script the same way as tibemsadmin command.

If  it is connected to standby server, it will exit:
============
$ ./tibemsadmin.sh  -server tcp://lwang-t430t:8224 -user admin -password admin
Connected to standby server, exit.
============

If it is connected to primary server it runs as a normal tibemsadmin command:
============
$ ./tibemsadmin.sh  -server tcp://lwang-t430:8222 -user admin -password admin

TIBCO Enterprise Message Service Administration Tool.
Copyright 2003-2013 by TIBCO Software Inc.
All rights reserved.

Version 7.0.1 V4 2/27/2013

Connected to: tcp://optimist:8222
Type 'help' for commands help, 'exit' to exit:
:::
==============

This script has been tested on Linux platforms.

Issue/Introduction

Wrapper script for tibemsadmin command to prevent changes to a standby EMS server.