微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

配置Linux软件自启动集中方法

1.简介

init.d 和 systemd 是负责Ubuntu 和 CentOS程序自启动命令框架。

2.软链接ln

创建程序用户xxx
ln -s /usr/local/nexus-3.16.0-01/bin/nexus  /etc/init.d/nexus

cd /etc/init.d
chkconfig --add nexus
chkconfig --levels 345 nexus on
service nexus start

3.使用systemd脚本

vi /etc/systemd/system/nexus.service
[Unit]
Description=nexus service
After=network.target
  
[Service]
Type=forking
LimitNOFILE=65536
ExecStart=/usr/local/nexus-3.16.0-01/bin/nexus start
ExecStop=/usr/local/nexus-3.16.0-01/bin/nexus stop
User=nexus
Restart=on-abort
  
[Install]
WantedBy=multi-user.target

3.1增加脚本执行

chmod a+x nexus.service

3.2激活

systemctl daemon-reload
systemctl enable nexus.service

3.3 重启后查看启动情况

tail -f /usr/local/sonatype-work/nexus3/log/nexus.log

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐