教你centos如何配置开机自动启动RabbitMq软件的方法

1.在/etc/init.d 目录下新建一个 rabbitmq

[root@localhost init.d]# vi rabbitmq

文件内容

#!/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.对rabbitmq授予可执行权限

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

3. 添加rabbitmq服务到系统服务中

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

4.设置自启动

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

5.查看自启动项是否设置成功

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

6.开启rabbit服务

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

 7.测试开机重启

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

1.在/etc/init.d 目录下新建一个 rabbitmq

[root@localhost init.d]# vi rabbitmq

文件内容

#!/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.对rabbitmq授予可执行权限

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

3. 添加rabbitmq服务到系统服务中

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

4.设置自启动

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

5.查看自启动项是否设置成功

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

6.开启rabbit服务

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

 7.测试开机重启

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

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。

我想要获取技术服务或软件
服务范围:MySQL、ORACLE、SQLSERVER、MongoDB、PostgreSQL 、程序问题
服务方式:远程服务、电话支持、现场服务,沟通指定方式服务
技术标签:数据恢复、安装配置、数据迁移、集群容灾、异常处理、其它问题
沟通购买:QQ咨询 淘宝咨询 微信咨询 淘宝店铺
版权申明及联系
本站部分文章参考或来源于网络,如有侵权请联系站长。本站提供相关远程技术服务,有需要可联系QQ
数据库远程运维 » 教你centos如何配置开机自动启动RabbitMq软件的方法