centos开机自动启动RabbitMq软件的方法
更新时间:2021年11月25日 08:58:01 作者:chester.chen
本文详细讲解了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
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持脚本之家。
相关文章
Win8.1 + CentOS7 双系统 U盘安装(超详细教程)
这篇文章主要介绍了Win8.1 + CentOS7 双系统 U盘安装(超详细教程),非常具有实用价值,需要的朋友可以参考下。2017-01-01
详解如何在 CentOS 7 上安装和安全配置 MariaDB 10
这篇文章主要介绍了详解如何在 CentOS 7 上安装和安全配置 MariaDB 10,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧2017-03-03
Apache和Tomcat有什么区别_动力节点Java学院整理
Apache 和 Tomcat 都是web网络服务器,两者既有联系又有区别。下面通过本文给大家介绍Apache和Tomcat的区别,感兴趣的朋友一起看看吧2017-08-08


最新评论