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