1、修改rocketmq参数
#!/bin/bash pid_namesrv=`ps -ef | grep rocketmq | grep java |grep namesrv.properties | grep -v grep | awk '{print $2}'` for i in $pid_namesrv do user_roc1=`ps -ef | grep $i | grep -v grep | awk '{print $1}'` sudo user_roc=`cat /etc/passwd | grep $user_roc1 | awk -F : '{print $1}'` ip_namesrv=`hostname -I | awk '{print $1}'` conf_namesrv=`ps -ef | grep $i | grep -v grep | awk -F "-c" '{print $NF}'` port_namesrv=`cat $conf_namesrv | grep listenPort | awk '{print $NF}'` soc_namesrv="$ip_namesrv:$port_namesrv" conf_namesrv2=`dirname $conf_namesrv` cd $conf_namesrv2 && cd ../bin dir_namesrv=`pwd` if [ -f mqadmin ];then sudo chmod +x mqadmin sudo su - $user_roc -c "$dir_namesrv/mqadmin updateBrokerConfig -n '$soc_namesrv' -c DefaultCluster -k haSendHeartbeatInterval -v 5000" else echo "the mqadmin file not exist." exit 3 fi done