Nacos virtual machine settings start automatically at boot

  1. Execute command: vi /lib/systemd/system/nacos.servicecreate and edit files
  2. Put the following code into this file, pay attention to the location of your nacos, that is, ExecStartthe path related ExecReloadto ExecStopnacos behind
[Unit]
Description=nacos
After=network.target

[Service]
Type=forking
TimeoutSec=0 #防止启动超时
User=root
Group=root
cription=nacos
After=network.target

[Service]
Type=forking
TimeoutSec=0 #防止启动超时
User=root
Group=root

ExecStart=/bin/bash /usr/local/nacos/bin/startup.sh
ExecReload=/usr/local/nacos/bin/shutdown.sh
ExecStop=/usr/local/nacos/bin/shutdown.sh
Restart=on-failure
PrivateTmp=true

[Install]
WantedBy=multi-user.target
  1. Excuting an ordersystemctl daemon-reload
  2. Excuting an ordersystemctl enable nacos.service
    Insert image description here
  3. Start nacos:systemctl start nacos
  4. View status:systemctl status nacos
    Insert image description here

Guess you like

Origin blog.csdn.net/weixin_45495923/article/details/131727419