linux中设置nexus开机自启动的方法
作者:嗑嗑嗑瓜子的猫
这篇文章主要介绍了linux中设置nexus开机自启动的方法,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧
一、把nexus配置成服务
1、新建服务脚本
vim /etc/init.d/nexus
添加以下脚本内容
#!/bin/bash
#chkconfig:2345 20 90
#description:nexus
#processname:nexus
export JAVA_HOME=/usr/local/jdk1.8.0_60
case $1 in
start) su root /usr/local/nexus-3.12.1-01/bin/nexus start;;
stop) su root /usr/local/nexus-3.12.1-01/bin/nexus stop;;
status) su root /usr/local/nexus-3.12.1-01/bin/nexus status;;
restart) su root /usr/local/nexus-3.12.1-01/bin/nexus restart;;
dump) su root /usr/local/nexus-3.12.1-01/bin/nexus dump;;
console) su root /usr/local/nexus-3.12.1-01/bin/nexus console;;
*) echo "Usage: nexus {start|stop|run|run-redirect|status|restart|force-reload}"
esac配置完后,保存退出
2、给新建的脚本设置执行权限
chmod 744 /etc/init.d/nexus
3、执行以下命令进行启动、停止 和 重启nexus服务
#启动 service nexus start #停止 service nexus stop #重启 service nexus restart #查看nexus的状态 service nexus status
二、配置nexus服务开机自启动
#向chkconfig添加 nexus 服务的管理 chkconfig --add nexus #设置nexus服务自启动 chkconfig nexus on #关闭nexus服务自启动 chkconfig nexus off #删除nexus服务在chkconfig上的管理 chkconfig –del nexus
这样就成功配置了nexus在linux下开机自启动
到此这篇关于linux中设置nexus开机自启动的方法的文章就介绍到这了,更多相关linux nexus开机自启动内容请搜索脚本之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持脚本之家!
