自动启动
- 一般我们系统都避免不了的重启,常见的持续环境工具又多,免不了增加一些日常额外工作
- 配置如下
- touch /usr/lib/systemd/system/nexus.service
- vi /usr/lib/systemd/system/nexus.service
- 脚本如下
[Unit] Description=nexus service After=network.target [Service] Type=forking Environment=RUN_AS_USER=root Environment=PATH=//usr/local/lab/jdk1.8.0_241/bin://usr/local/lab/jdk1.8.0_241/jre/bin://usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/root/bin ExecStart=/usr/local/lab/nexus-3.6.0-02/bin/nexus start ExecStop=/usr/local/lab/nexus-3.6.0-02/bin/bin/nexus stop User=root Restart=on-abort [Install] WantedBy=multi-user.target
- chmod a+x nexus.service
- systemctl daemon-reload
- systemctl start nexus
- systemctl status nexus.service
- reboot
参考网址
来源:oschina
链接:https://my.oschina.net/kcnf/blog/4267678