Centos rabbitmq starts at boot

1, numbered startup script

vi /etc/rc.d/init.d/rabbitmq

The content is as follows

#!/bin/bash#chkconfig:2345 61 61export HOME=/home/rabbitmq/data/export PATH=$PATH:/usr/local/erlang/binexport PATH=$PATH:/usr/local/rabbitmq_server-3.8.5/sbincase "$1" instart)echo "Starting RabbitMQ..."rabbitmq-server -detached;;stop)echo "Stopping RabbitMQ..."rabbitmqctl stop;;status)echo "Status RabbitMQ..."rabbitmqctl status;;restart)echo "Restarting RabbitMQ ..."rabbitmqctl stoprabbitmq-server restart;;*)echo "Usage: $prog {start|stop|status|restart}";;esacexit 0

2, configure permissions

chmod +x /etc/rc.d/init.d/rabbitmq

3, register startup items

chkconfig –add rabbitmq
chkconfig rabbitmq on
chkconfig –list rabbitmq #Check whether the registration takes effect

4, start the service

service rabbitmq start

Read more here: Source link