1. 在 /lib/systemd/system 创建 service 文件
sudo vim /lib/systemd/system/my_first.service
[Unit]
Description=my_first service
After=network.target network-online.target syslog.target
Wants=network.target network-online.target[Service]
Type=simple
ExecStart=/your/path/my_first -c /your/path/my_first_param[Install]
WantedBy=multi-user.target
2. 启动
sudo systemctl start my_first
3.设置自启动
sudo systemctl enable my_first
4. 启动、停止、重启
sudo systemctl start my_first
sudo systemctl stop my_first
sudo systemctl restart my_first