创建服务脚本
在linux系统的/etc/init.d/目录下创建nexus文件的链接,使用如下命令:
[root@mini-like nexus]# ln -s /usr/share/nexus/bin/nexus /etc/init.d/nexus
然后,就可以通过该脚本对服务进行管理了:
/etc/init.d/nexus start
/etc/init.d/nexus stop
服务启动问题解决
nexus启动失败,查找nexus/logs/wrapper.logs,发现如下错误:
根据错误,一般需要修改配置的话,一般在如下两个文件里面
nexus/bin/jsw/conf/wrapper.conf
nexus/conf/nexus.properties
注册为自启动服务
上面的方法完成了用脚本管理nginx服务的功能,但是还是不太方便,比如要设置nexus开机启动等。这时可以使用chkconfig来设置。
先将nexus服务加入chkconfig管理列表:
chkconfig --add /etc/init.d/nexus
加完这个之后,就可以使用service对nexus进行启动,重启等操作了。
service nexus start
service nexus stop
设置终端模式开机启动:
chkconfig --level 35 nexus on