cpp 可执行文件是 -rwxr-xr-x FixedNode 其中所有者是 pi 运行可执行文件的文件是 -rwxr-xr-x startFixedNode where owner = pi `#/bin/sh
导出 LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
/home/pi/fixedNode/FixedNode`
服务在 /etc/systemd/system/ 服务文件是 -rwxrwxrwx 所有者是 root 的 fixedNode.service [单元] 说明=固定节点服务 After=network.target
[Service]
WorkingDirectory=/home/pi/fixedNode
ExecStart=/home/pi/fixedNode/startFixedNode
User=pi
[Install]
WantedBy=multi-user.target
Ran "sudo systemctl enable /etc/systemd/system/fixedNode.service"
Ran "sudo systemctl daemon-reload"
Ran "sudo reboot"
它没有自动启动
运行“sudo systemctl status /etc/systemd/system/fixedNode.service” 并获得活动:失败 进程526 ExecStart=/home/pi/fixedNode/startFixedNode(代码=退出,状态=134)
Ran "sudo systemctl start /etc/systemd/system/fixedNode.service" and it runs without issue