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

Analysis of GTK treeview principle and usage

The GtkTreeView component is an advanced componen...

How to use async and await in JS

Table of contents 1. async 2. await: 3. Comprehen...

Restart all stopped Docker containers with one command

Restart all stopped Docker containers with one co...

Several mistakes that JavaScript beginners often make

Table of contents Preface Confusing undefined and...

Solution to the problem "Table mysql.plugin doesn't exist" when deploying MySQL

Today I deployed the free-installation version of...

How to get the size of a Linux system directory using the du command

Anyone who has used the Linux system should know ...

Detailed installation tutorial of mysql-8.0.11-winx64.zip

Download the zip installation package: Download a...

Analysis of the difference between bold <b> and <strong>

All of us webmasters know that when optimizing a ...

How to use linux commands to convert and splice audio formats

Install FFmpeg flac eric@ray:~$ sudo apt install ...

Detailed explanation of the concept of docker container layers

Table of contents 01 Container consistency 02 Con...

A brief discussion on three methods of asynchronous replication in MySQL 8.0

In this experiment, we configure MySQL standard a...

How to make an input text box change length according to its content

First: Copy code The code is as follows: <input...

Reasons and solutions for prompting to save action after uploading files in form

The json data must be returned in html format That...

Detailed steps to use Redis in Docker

1. Introduction This article will show you how to...