首页 > 其他分享 >Creating a Unix Service for ActiveMQ

Creating a Unix Service for ActiveMQ

时间:2023-07-24 20:07:18浏览次数:40  
标签:opt java Creating ActiveMQ Unix sh home activemq


Below are steps to make ActiveMQ a Linux Daemon on Red Hat 4 ES.

It's based on this article.

Alternatively, you could also use the Java Service Wrapper implementation, refer to the Java Service Wrapper Page for more details.

Settings



JAVA_HOME = /opt/java/jdk1.5.0_06
ActiveMQ = /opt/activemq/incubator-activemq-4.0



Installation

Sun Java JDK

1. Install Sun Java JDK on /opt/java/ directory.

2. Create a shortcut to JDK directory:



sudo ln -s /opt/java/jdk1.5.0_06 /opt/java/java



ActiveMQ

1. Install ActiveMQ on /opt/activemq/ directory.

2. Make ActiveMQ startup and shutdown scripts executable:



sudo chmod +x /opt/activemq/incubator-activemq-4.0/bin/activemq
sudo chmod +x /opt/activemq/incubator-activemq-4.0/bin/shutdown



ActiveMQ as Linux Daemon

1. Create activemq user:



sudo /usr/sbin/useradd activemq



2. Create ActiveMQ startup script /home/activemq/activemqstart.sh with the
following content:



#!/bin/bash
export JDK_HOME=/opt/java/java
export JAVA_HOME=/opt/java/java
/opt/activemq/incubator-activemq-4.0/bin/activemq &



3. Make /home/activemq/activemqstart.sh executable:



sudo chmod +x /home/activemq/activemqstart.sh



4. Create ActiveMQ shutdown script /home/activemq/activemqstop.sh with the
following content:



#!/bin/bash
export JDK_HOME=/opt/java/java
export JAVA_HOME=/opt/java/java
/opt/activemq/incubator-activemq-4.0/bin/shutdown



5. Make /home/activemq/activemqstop.sh executable:



sudo chmod +x /home/activemq/activemqstop.sh



6. Create ActiveMQ Linux service configuration script /etc/init.d/activemq
with the following content:



#!/bin/bash
#
# activemq       Starts ActiveMQ.
#
#
# chkconfig: 345 88 12
# description: ActiveMQ is a JMS Messaging Queue Server.
### BEGIN INIT INFO
# Provides: $activemq
### END INIT INFO

# Source function library.
. /etc/init.d/functions

[ -f /home/activemq/activemqstart.sh ] || exit 0
[ -f /home/activemq/activemqstop.sh ] || exit 0

RETVAL=0

umask 077

start() {
       echo -n $"Starting ActiveMQ: "
       daemon /home/activemq/activemqstart.sh
       echo
       return $RETVAL
}
stop() {
       echo -n $"Shutting down ActiveMQ: "
       daemon su -c /home/activemq/activemqstop.sh activemq
       echo
       return $RETVAL
}
restart() {
       stop
       start
}
case "$1" in
 start)
       start
       ;;
 stop)
       stop
       ;;
 restart|reload)
       restart
       ;;
 *)
       echo $"Usage: $0 {start|stop|restart}"
       exit 1
esac

exit $?



7. Enable ActiveMQ service configuration as Linux Daemon:



sudo chmod +x /etc/init.d/activemq
sudo /sbin/chkconfig --add activemq
sudo /sbin/chkconfig activemq on



8. Restart the server.

Note: activemq-data is being created in "/" root directory. I have to
explicitly set the activemq-data location in activemq.conf

标签:opt,java,Creating,ActiveMQ,Unix,sh,home,activemq
From: https://blog.51cto.com/u_16203469/6838246

相关文章

  • Creating network "docker_default" with the default driver ERROR: Failed to S
    创建网络"docker_default"withthedefaultdriverERROR:FailedtoS在使用Docker容器时,有时会遇到以下错误信息:Creatingnetwork"docker_default"withthedefaultdriverERROR:FailedtoS。这个错误通常表示Docker无法创建名为"docker_default"的网络。本文将解释此错......
  • springboot整合activeMQ
    依赖<?xmlversion="1.0"encoding="UTF-8"?><projectxmlns="http://maven.apache.org/POM/4.0.0"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/POM/4......
  • set ff=unix
    今天在公司部署项目的时候,执行启动脚本的时候,出现,不能识别这个命令的错误。很纳闷于是寻求同事的帮助,同事说,你需要设置一下这个启动脚本的换行符格式就好了。具体解决办法:使用vi编辑器,执行virun.sh然后输入:setff=unix,使用Unix换行符。然后将run.sh启动脚本中涉及到......
  • K8S初始化报错:CRI v1 runtime API is not implemented for endpoint \"unix:///var/r
    报错具体内容:[preflight]Somefatalerrorsoccurred:[ERRORCRI]:containerruntimeisnotrunning:output:time="2023-07-21T09:20:07Z"level=fatalmsg="validateserviceconnection:CRIv1runtimeAPIisnotimplementedforendpoint\"un......
  • error creating overlay mount to /var/lib/docker/overlay2/b2e5a97deb6343f6dfb
    错误创建overlay挂载点到/var/lib/docker/overlay2/b2e5a97deb6343f6dfb在使用Docker时,有时会遇到错误信息"errorcreatingoverlaymountto/var/lib/docker/overlay2/b2e5a97deb6343f6dfb"。这个错误通常出现在试图创建Docker容器时,它指示Docker无法创建overlay2的挂载点。ove......
  • java 获取当前unix时间戳
    Java获取当前Unix时间戳Unix时间戳是指从协调世界时(UTC)1970年1月1日00:00:00开始至今的总秒数。Unix时间戳被广泛用于计算机系统和编程语言中,用于表示时间和日期。在Java中,我们可以使用java.time包下的类来获取当前的Unix时间戳。使用java.time.Instant......
  • ActiveMQ单机部署
    一、ActiveMQ基础1.1、官网地址http://activemq.apache.org1.2、官网下载地址https://activemq.apache.org/components/classic/download/1.3、jdk下载地址https://www.oracle.com/java/technologies/downloads/#java18二、ActiveMQ安装2.1、安装jdk解压缩安装包到指定路......
  • 配置问题-Error creating bean with name 'user' defined in class path resource [be
    正在学习IoC使用的jdk版本为jdk17依赖为:<dependencies><dependency><groupId>org.springframework</groupId><artifactId>spring-core</artifactId><version>6.0.6</version></dependen......
  • Unix C的Http服务器技术实现原理
    基于tiny-httpd的一个httpserver,可处理GET和POST请求。知识范围:POSIX接口pipe(intarr[2])pipe(intarr[2]);使用pipe会创建通道,arr[0]为读,arr[1]为写。dup2-复制文件描述符这个fd我目前理解是用来读数据的,使用dup2相当于直接复制了oldfd对应的数据dup2(oldfd,newfd)......
  • Tenable Nessus 10.5.3 (Unix, Linux, Windows) - #1 漏洞评估解决方案
    TenableNessus10.5.3(Unix,Linux,Windows)-#1漏洞评估解决方案发布Nessus试用版自动化安装程序,支持macOSVentura、RHEL9和Ubuntu22.04请访问原文链接:https://sysin.org/blog/nessus-10/,查看最新版。原创作品,转载请保留出处。作者主页:sysin.orgNessus漏洞评......