CentOS7 下 ActiveMQ 开机启动

本文介绍了一种通过自定义Shell脚本来管理和操作ActiveMQ服务的方法。该脚本能够实现ActiveMQ服务的启动、停止及重启等功能,并详细说明了如何将此脚本设置为系统服务,以便进行更便捷的服务管理。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

尝试了很多种方法,最终使用自己编写脚本,启动 activemq

 

#!/bin/sh
#
# /etc/init.d/activemq
# chkconfig: 345 63 37
# description: activemq servlet container.
# processname: activemq 5.15.2


# Source function library.
#. /etc/init.d/functions
# source networking configuration.
#. /etc/sysconfig/network


export JAVA_HOME=/usr/java/jdk1.8.0_144
export CATALINA_HOME=/root/apache-activemq-5.15.2


case $1 in
    start)
        sh $CATALINA_HOME/bin/activemq start
    ;;
    stop)
        sh $CATALINA_HOME/bin/activemq stop
    ;;
    restart)
        sh $CATALINA_HOME/bin/activemq stop
        sleep 1
        sh $CATALINA_HOME/bin/activemq start
    ;;
    status)
        sh $CATALINA_HOME/bin/activemq status
    ;;
esac
exit 0

设置文件权限:chmod 777 activemq

添加到服务:chkconfig --add activemq

服务自启动:chkconfig activemq on

服务启动/停止/重启命令:service activemq start/stop/restart
 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值