微信上优惠券的网站怎么做的,如何在网上开店,wordpress登录之后强制绑定邮箱,做企业网站都需要注意哪点硬件#xff1a;树霉派4B 系统#xff1a;ubuntu20.04
在ubuntu20.04上经常需要运行 ./BluetoothServerParse_L.c ,比较繁琐#xff0c;想要设置开机自启动#xff0c;让树霉派4B在接上电源之后就自动运行该程序。使用systemd服务#xff0c;设置步骤如下#xff1a;
树霉派4B 系统ubuntu20.04
在ubuntu20.04上经常需要运行 ./BluetoothServerParse_L.c ,比较繁琐想要设置开机自启动让树霉派4B在接上电源之后就自动运行该程序。使用systemd服务设置步骤如下
1在/etc/systemd/system/下创建一个systemd服务文件例如BluetoothServerParse_L.service。 当遇到权限不够时就用root用户即使用sudo。
2打开BluetoothServerParse_L.service并编辑该文件内容大致如下
[Unit]
DescriptionYour Service Description
Aftermulti-user.target [Service]
ExecStart/path/to/your/BluetoothServerParse_L
Restarton-failure [Install]
WantedBymulti-user.target将/path/to/your/BluetoothServerParse_L替换为你的脚本或程序的完整路径。
根据BluetoothServerParse_L实际路径我在BluetoothServerParse_L.service中添加的内容如下
[Unit]
DescriptionBluetooth Server Parse Service
Afternetwork.target [Service]
ExecStart/home/ubuntu/ccy/glove_car_bt/ros_udp_udp-main/src/udp_udp/C/BluetoothServerParse_L
Restarton-failure [Install]
WantedBymulti-user.target保存、关闭文件。
3重新加载systemd守护进程以应用更改
sudo systemctl daemon-reload4启用并启动服务
sudo systemctl enable BluetoothServerParse_L.service
sudo systemctl start BluetoothServerParse_L.service5查看服务的状态
sudo systemctl status BluetoothServerParse_L.service服务已经成功启动并且状态为 active (running)。 主进程 IDMain PID是 9249并且它正在执行 /home/ubuntu/ccy/glove_car_bt/ros_udp_udp-main/src/udp_udp/C/BluetoothServerParse_L
经过以上步骤自启动文件就设置成功了。