nexus 开机自启动

一.创建shell服务脚本

         创建脚本nexus,并将脚本文件放在/etc/init.d 服务启动目录

#!/bin/bash    
#chkconfig:2345 20 90    
#description:nexus    
#processname:nexus    
export NEXUS_HOME=/opt/nexus/nexus-3.6/
case $1 in    
        start) su root $NEXUS_HOME/bin/nexus start;;    
        stop) su root $NEXUS_HOME/bin/nexus stop;;    
        status) su root $NEXUS_HOME/bin/nexus status;;    
        restart) su root $NEXUS_HOME/bin/nexus restart;;    
        dump ) su root $NEXUS_HOME/bin/nexus dump ;; 
        console ) su root $NEXUS_HOME/bin/nexus console ;;          
        *) echo "require console | start | stop | restart | status | dump " ;;    
esac

二.配置权限

chmod +x /opt/nexus/nexus-3.6/bin/nexus
chmod +x /etc/init.d/nexus

三. 让chkconfig 管理脚本

#添加服务
chkconfig --add nexus
#开机自启动
chkconfig nexus on

四.启动服务

service nexus start
原文地址:https://www.cnblogs.com/chengjunhao/p/8277749.html