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

Solution to 1449 and 1045 exceptions when connecting to MySQL

Solution to 1449 and 1045 exceptions when connect...

How to use jsx syntax correctly in vue

Table of contents Preface Virtual DOM What is Vir...

VMware Workstation installation Linux system

From getting started to becoming a novice, the Li...

Solution to the garbled code problem in MySQL 5.x

MySQL is a commonly used open source database sof...

MySQL sequence AUTO_INCREMENT detailed explanation and example code

MySQL sequence AUTO_INCREMENT detailed explanatio...

Simple web page code used in NetEase blog

How to use the code in NetEase Blog: First log in...

Implementing WeChat tap animation effect based on CSS3 animation attribute

Seeing the recent popular WeChat tap function, I ...

A brief discussion on the CSS overflow mechanism

Why do you need to learn CSS overflow mechanism i...

Do you know how to use Vue to take screenshots of web pages?

Table of contents 1. Install html2Canvas 2. Intro...

Introduction to the common API usage of Vue3

Table of contents Changes in the life cycle react...

Detailed explanation of Vue two-way binding

Table of contents 1. Two-way binding 2. Will the ...

How to deploy MySQL 5.7 & 8.0 master-slave cluster using Docker

> Deploy MySQL 5.7 cluster master & slave ...

Solution to the problem of adaptive height and width of css display table

Definition and Usage The display property specifi...