1.在/etc/systemd/system创建scanner.service 文件
[Unit]
Description=Protocol Scanner Service
After=multi-user.target network.target
[Service]
Type=simple
ExecStart=/home/user/Distribute/scanner/ProtocolScanner
Restart=always
RestartSec=10
User=user
Group=user
[Install]
WantedBy=multi-user.targe
2.激活服务
$ sudo systemctl enable scanner
3.启动服务并检查状态
$ sudo systemctl start rc-local.service
$ sudo systemctl status rc-local.service