Renaming Websphere MQFTE agents

Renaming Websphere MQFTE agents @ www.Vasilev.link DevOps consultant
Jan 20, 2015

Hello, after thinking about how somebody can create a new FTE agent on the same machine with a different name,
I have created this script, which is very fast.


OLD_AGENT_NAME=$1;
NEW_AGENT_NAME=$2;
AGENT_DIR="directory with all agents";
AGENT_CERTDIR="directory with agent certificates";
if [ -z "$NEW_AGENT_NAME" ]
then
    echo "Usage: $0 OLD_AGENT_NAME NEW_AGENT_NAME";
    exit 1;
fi
cp -R $AGENT_DIR$OLD_AGENT_NAME/ $AGENT_DIR$NEW_AGENT_NAME;
cp -R $AGENT_CERTDIR$OLD_AGENT_NAME/ $AGENT_CERTDIR$NEW_AGENT_NAME;
mv $AGENT_DIR$NEW_AGENT_NAME/${OLD_AGENT_NAME}_create.mqsc $AGENT_DIR$NEW_AGENT_NAME/${NEW_AGENT_NAME}_create.mqsc;
mv $AGENT_DIR$NEW_AGENT_NAME/${OLD_AGENT_NAME}_delete.mqsc $AGENT_DIR$NEW_AGENT_NAME/${NEW_AGENT_NAME}_delete.mqsc;
echo "%s/$OLD_AGENT_NAME/$NEW_AGENT_NAME/g
w
q
" | ex $AGENT_DIR$NEW_AGENT_NAME/${NEW_AGENT_NAME}_create.mqsc;
echo "%s/$OLD_AGENT_NAME/$NEW_AGENT_NAME/g
w
q
" | ex $AGENT_DIR$NEW_AGENT_NAME/${NEW_AGENT_NAME}_delete.mqsc;
echo "%s/$OLD_AGENT_NAME/$NEW_AGENT_NAME/g
w
q
" | ex $AGENT_DIR$NEW_AGENT_NAME/agent.properties;
cat $AGENT_DIR$NEW_AGENT_NAME/agent.properties | grep agentQMg;
cat $AGENT_DIR$NEW_AGENT_NAME/${NEW_AGENT_NAME}_create.mqsc

After that we have few more steps to do.

On the server where qmanager is running, to which the agent is connecting we should execute the "create" script.
And that is all. Now we can start the new File transfer agent.