Uniform username
@@ -19,14 +19,16 @@ setup() {
else
ps -C rabbitmq-server > /dev/null || sudo /etc/init.d/rabbitmq-server restart > /dev/null
fi
- NODE_ID=`echo ${node} |awk -F/ '{print $2}'`
+ RABBITMQ_USER=cita_monitor
sudo rabbitmqctl list_vhosts | grep ${node} > /dev/null && sudo rabbitmqctl delete_vhost ${node} > /dev/null
sudo rabbitmqctl add_vhost ${node} > /dev/null
sudo rabbitmqctl set_permissions -p ${node} guest '.*' '.*' '.*' > /dev/null
sudo rabbitmq-plugins enable rabbitmq_management > /dev/null
- sudo rabbitmqctl add_user cita${NODE_ID}_monitor cita_monitor > /dev/null
- sudo rabbitmqctl set_user_tags cita${NODE_ID}_monitor monitoring > /dev/null
- sudo rabbitmqctl set_permissions -p ${node} cita${NODE_ID}_monitor '.*' '.*' '.*' > /dev/null
+ sudo rabbitmqctl list_users | grep ${RABBITMQ_USER} > /dev/null && sudo rabbitmqctl delete_user ${RABBITMQ_USER} > /dev/null
+ sudo rabbitmqctl add_user ${RABBITMQ_USER} cita_monitor > /dev/null
+ sudo rabbitmqctl set_user_tags ${RABBITMQ_USER} monitoring > /dev/null
+ sudo rabbitmqctl set_permissions -p ${node} ${RABBITMQ_USER} '.*' '.*' '.*' > /dev/null
+
# setup env
