Linux环境设置zookeeper、memcached、activemq、dubbo自动启动

一 zookeeper

1 修改zkServer.sh(/usr/local/zookeeper-3.4.5/bin/zkServer.sh)文件的第一行:

#!/usr/bin/env bash

为:

#!/bin/bash

# description: Zookeeper Start Stop Restart

# processname: zookeeper

# chkconfig: 244 30 80

 

2 修改:

# use POSTIX interface, symlink is followed automatically

ZOOBIN=”${BASH_SOURCE-$0}”

ZOOBIN=`dirname ${ZOOBIN}`

ZOOBINDIR=`cd ${ZOOBIN}; pwd`

 

if [ -e “$ZOOBIN/../libexec/zkEnv.sh” ]; then

# use POSTIX interface, symlink is followed automatically

ZOOSH=`readlink $0`

ZOOBIN=`dirname $ZOOSH`

ZOOBINDIR=`cd $ZOOBIN; pwd`

ZOO_LOG_DIR=`echo $ZOOBIN`

 

if [ -e “$ZOOBIN/../libexec/zkEnv.sh” ]; then

 

3 创建软链接:

[root@dev-middleware ~]# ln -s /usr/local/zookeeper-3.4.5/bin/zkServer.sh  /etc/init.d/zookeeper

 

4 添加自动启动

[root@dev-middleware ~]# chkconfig –list zookeeper

zookeeper 服务支持 chkconfig,但它在任何级别中都没有被引用(运行“chkconfig –add zookeeper”)

[root@dev-middleware ~]# chkconfig –add zookeeper

[root@dev-middleware ~]# chkconfig –level 2345 zookeeper on

[root@dev-middleware ~]# chkconfig –list zookeeper

zookeeper       0:关闭  1:关闭  2:启用  3:启用  4:启用  5:启用  6:关闭

[root@dev-middleware ~]#

 

5 参考

http://positivealex.github.io/blog/posts/how-to-install-zookeeper-as-service-on-centos/

二 memcached

[root@dev-middleware ~]# chkconfig –list memcached

memcached 服务支持 chkconfig,但它在任何级别中都没有被引用(运行“chkconfig –add memcached”)

[root@dev-middleware ~]# chkconfig –add memcached

[root@dev-middleware ~]# chkconfig –level 2345 memcached on

[root@dev-middleware ~]# chkconfig –list memcached

memcached       0:关闭  1:关闭  2:启用  3:启用  4:启用  5:启用  6:关闭

[root@dev-middleware ~]#

三 activemq

1 修改文件activemq (/usr/local/apache-activemq-5.9.0/bin/activemq),第1行:

#!/bin/sh

为:

#!/bin/sh

### BEGIN INIT INFO

# Provides:             activemq

# Required-Start:       $remote_fs $syslog

# Required-Stop:        $remote_fs $syslog

# Default-Start:        2 3 4 5

# Default-Stop:         0 6

# Short-Description:    ActiveMQ server

### END INIT INFO

 

2 创建软链接:

[root@dev-middleware bin]# ln -s /usr/local/apache-activemq-5.9.0/bin/activemq /etc/init.d/activemq

[root@dev-middleware bin]#

 

3 添加自动启动

[root@dev-middleware bin]# chkconfig –list activemq

activemq 服务支持 chkconfig,但它在任何级别中都没有被引用(运行“chkconfig –add activemq”)

[root@dev-middleware bin]# chkconfig –add activemq

[root@dev-middleware bin]# chkconfig –level 2345 activemq on

[root@dev-middleware bin]# chkconfig –list activemq

activemq        0:关闭  1:关闭  2:启用  3:启用  4:启用  5:启用  6:关闭

[root@dev-middleware bin]#

 

4 参考

http://www.liaoxuefeng.com/article/0013738918072162b1c2a36eb0f40e690d3902acf60c8fb000

四 dubbo

 

[root@dev-middleware ~]# ll /etc/init.d/tomcat-dubbo-admin

-rwxr-xr-x 1 root root 1969 9月   8 13:49 /etc/init.d/tomcat-dubbo-admin

[root@dev-middleware ~]# /etc/init.d/tomcat-dubbo-admin

start/stop

[root@dev-middleware ~]# chkconfig –list tomcat-dubbo-admin

tomcat-dubbo-admin 服务支持 chkconfig,但它在任何级别中都没有被引用(运行“chkconfig –add tomcat-dubbo-admin”)

[root@dev-middleware ~]# chkconfig –add tomcat-dubbo-admin

[root@dev-middleware ~]# chkconfig –level 2345 tomcat-dubbo-admin on

[root@dev-middleware ~]# chkconfig –list tomcat-dubbo-admin

tomcat-dubbo-admin      0:关闭  1:关闭  2:启用  3:启用  4:启用  5:启用  6:关闭

[root@dev-middleware ~]#

发表评论

邮箱地址不会被公开。 必填项已用*标注