侧边栏壁纸
博主头像
落叶人生博主等级

走进秋风,寻找秋天的落叶

  • 累计撰写 130562 篇文章
  • 累计创建 28 个标签
  • 累计收到 9 条评论
标签搜索

目 录CONTENT

文章目录

Linux下ActiveMQ自启动

2023-11-17 星期五 / 0 评论 / 0 点赞 / 63 阅读 / 2003 字

1、在root权限下操作 2、cp /usr/local/activemq/bin/activemq /etc/init.d 3、cd /etc/init.d/ 4、vi activemq 5

1、在root权限下操作

2、cp /usr/local/activemq/bin/activemq /etc/init.d

3、cd /etc/init.d/

4、vi activemq

5、在第二行添加

#### BEGIN INIT INFO# Provides:             activemq# Required-Start:       $remote_fs $syslog# Required-Stop:        $remote_fs $syslog# Default-Start:        2 3 4 5# Default-Stop:         0 6# chkconfig: 2345 64 36# Short-Description:    ActiveMQ server### END INIT INFO


6、在最后一个#后添加

export JAVA_HOME=/usr/local/jdk7ACTIVEMQ_HOME=/usr/local/activemq


7、chmod +x activemq

8、chkconfig --add activemq

9、chkconfig --list 显示该服务则成功

---------------------------------------------------------------------------------------------

在Ubuntu中,有可能没有chkconfig命令或者执行失败,可以用Ubuntu的update-rc.d命令替换

问题

cp 到/etc/init.d目录下的时候,有时候启动会提示找不到路径等等问题,但是在安装目录启动就可以,所以可以通过软连接来实现启动脚本:
ln -s /usr/local/activemq/bin/activemq /etc/init.d/
vi /etc/init.d/activemq
---------------------------------------------
# 第二行插入
# chkconfig: 345 63 37
# description: Auto start ActiveMQ
---------------------------------------------
然后就可以添加开机启动了
chkconfig activemq on
chkconfig --list activemq
也可以正常用服务的命令启动和停止
service activemq start
service activemq status
service activemq stop

广告 广告

评论区