1、编写开机自启脚本
1 cd /etc/systemd/system 2 sudo vim hello.service
脚本内容:
[Unit] Description=hello [Service] Type=simple ExecStart=/mnt/data1/hello/loong Restart=always [Install] WantedBy=multi-user.target
2、启动
sudo systemctl start hello.service
3、修改配置文件后需要重加载配置
sudo systemctl daemon-reload
4、开机启动
systemctl enable hello.service
5、查看实时日志
sudo journalctl -f -u hello.service
标签:Ubuntu20.04,service,启动,sudo,systemctl,开机,hello From: https://www.cnblogs.com/Pynix/p/17800030.html