首页 > 代码库 > RockerMQ 服务理脚本 (CentOS)
RockerMQ 服务理脚本 (CentOS)
将此脚本放到/etc/init.d/ 并赋予可执行权限即可
注意 需要将java 及 mq安装目录改成你自己的
管理mqbroker
#/bin/bash #author:firxiao #data:20140917 #usage manage RocketMQ mqbroker # chkconfig: - 99 90 pid=`ps ax | grep -i ‘com.alibaba.rocketmq.broker.BrokerStartup‘ |grep java | grep -v grep | awk ‘{print $1}‘` ##mq安装位置## MQ_HOME=/opt/alibaba-rocketmq/bin ##java目录## export JAVA_HOME=/opt/jdk ##log位置## LOG_DIR=/var/log function start() { if [ -n "$pid" ]; then { echo "The mqbroker(${pid}) is running..." } else { cd $MQ_HOME ; nohup sh mqbroker > $LOG_DIR/mqbroker.log 2>&1 & echo $" mqbroker started logfile=$LOG_DIR/mqbroker.log" } fi } function stop() { if [ -z "$pid" ] ; then echo "No mqbroker running." exit -1; fi echo "The mqbroker(${pid}) is running..." kill ${pid} echo "Send shutdown request to mqbroker(${pid}) OK" } function status() { if [ -z "$pid" ] ; then echo "No mqbroker running." exit -1; fi echo "The mqbroker(${pid}) is running..." } case $1 in start) start ;; stop) stop ;; status) status
添加开机启动
#chkconfig --add /etc/init.d/mqbroker #chkconfig mqbroker on
RockerMQ 服务理脚本 (CentOS)
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。