Centos7 nexus 开机自启动

1、修改配置文件,/usr/local/nexus-2.14.9-01/bin/jsw/conf

​#开机没有环境变量,修改环境变量为绝对路径
# Set the JVM executable
# (modify this to absolute path if you need a Java that is not on the OS path)
#wrapper.java.command=java
wrapper.java.command=/java/jdk/jdk1.8/bin/java

​

2、在/etc/init.d/下创建nexus脚本

#!/bin/sh     
#chkconfig:2345 20 90      
#description:nexus      
#processname:nexus  
    
export JAVA_HOME=/java/jdk/jdk1.8
  
case $1 in      
        start) su root /usr/local/nexus-2.14.9-01/bin/nexus start;;      
        stop) su root /usr/local/nexus-2.14.9-01/bin/nexus stop;;      
        status) su root /usr/local/nexus-2.14.9-01/bin/nexus status;;      
        restart) su root /usr/local/nexus-2.14.9-01/bin/nexus restart;;      
        dump) su root /usr/local/nexus-2.14.9-01/bin/nexus dump ;;   
        console) su root /usr/local/nexus-2.14.9-01/bin/nexus console ;;           
        *) echo "require console | start | stop | restart | status | dump " ;;      
esac

3、加上可执行权限

chmod +x nexus

4、加入开机自启服务

chkconfig --add nexus

5、检查是否已加入开机自启服务

[root@localhost init.d]# chkconfig --list

mysqld         	0:off	1:off	2:on	3:on	4:on	5:on	6:off
netconsole     	0:off	1:off	2:off	3:off	4:off	5:off	6:off
network        	0:off	1:off	2:on	3:on	4:on	5:on	6:off
nexus          	0:off	1:off	2:on	3:on	4:on	5:on	6:off
redisd         	0:off	1:off	2:on	3:on	4:on	5:on	6:off

6、然后就可以使用service nexus  start 启动服务了

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值