How to automatically start RabbitMq software when centos starts

How to automatically start RabbitMq software when centos starts

1. Create a new rabbitmq in the /etc/init.d directory

[root@localhost init.d]# vi rabbitmq

File Contents

#!/bin/bash
#chkconfig:2345 61 61

export HOME=/opt/data/rabbitmq/
export PATH=$PATH:/usr/local/erlang/bin
export PATH=$PATH:/usr/local/src/rabbitmq_server-3.6.15/sbin
 
case "$1" in
    start)
    echo "Starting RabbitMQ ..."
    rabbitmq-server-detached
    ;;
stop)
    echo "Stopping RabbitMQ ..."
    rabbitmqctl stop
    ;;
status)
    echo "Status RabbitMQ ..."
    rabbitmqctl status
    ;;
restart)
    echo "Restarting RabbitMQ ..."
    rabbitmqctl stop
    rabbitmq-server restart
    ;;
 
*)
    echo "Usage: $prog {start|stop|status|restart}"
    ;;
esac
exit 0

2. Grant executable permissions to rabbitmq

[root@localhost init.d]# chmod 777 rabbitmq

3. Add rabbitmq service to system services

[root@localhost init.d]# chkconfig --add rabbitmq

4. Set up auto-start

[root@localhost init.d]# chkconfig rabbitmq on

5. Check whether the startup item is set successfully

[root@localhost init.d]# chkconfig --list rabbitmq

6. Enable rabbit service

[root@localhost init.d]# ./rabbitmq start

7. Test boot and restart

[root@localhost init.d]#reboot
[root@localhost ~]# ps -elf|grep rabbitmq

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • How to install rabbitmq-server using yum on centos
  • Tutorial on installing rabbitmq using yum on centos8
  • Centos7.3 RabbitMQ distributed cluster construction example
  • Tutorial on building a high-availability cluster environment for RabbitMq under CentOS

<<:  Introduction to Sublime Text 2, a web front-end tool

>>:  Detailed explanation of the default values ​​of width and height in CSS: auto and %

Recommend

Installation tutorial of mysql5.7.21 decompression version under win10

Install the unzipped version of Mysql under win10...

Vue Router vue-router detailed explanation guide

Chinese documentation: https://router.vuejs.org/z...

Ubuntu 16.04 kernel upgrade steps

1. Environment Ubuntu 16.04 running on a virtual ...

Table of CSS Bugs Caused by hasLayout

IE has had problems for a long time. When everyone...

Docker starts Redis and sets the password

Redis uses the apline (Alps) image of Redis versi...

CSS3 uses animation attributes to achieve cool effects (recommended)

animation-name animation name, can have multiple ...

An example of the calculation function calc in CSS in website layout

calc is a function in CSS that is used to calcula...

A brief discussion on the use and analysis of nofollow tags

Controversy over nofollow There was a dispute bet...

Learn asynchronous programming in nodejs in one article

Table of Contents Introduction Synchronous Asynch...

27 Linux document editing commands worth collecting

Linux col command The Linux col command is used t...

Solve the error of installing VMware Tools on Ubuntu 18.04

1. According to the online tutorial, the installa...

12 Useful Array Tricks in JavaScript

Table of contents Array deduplication 1. from() s...

Summary of various methods for JavaScript to determine whether it is an array

Table of contents Preface Array.isArray construct...

How to make a website front end elegant and attractive to users

The temperament of a web front-end website is a fe...