概述
随着NVIDIA的xavier及orin系列硬件平行推出,自动驾驶车端处理器也逐渐频繁开发及使用.
开机脚本使用
/etc/profile :通常在系统登录时,会执行(多次登录,多次执行)
xavier上增加开机启动脚本,不能在/etc/profile,因此只能重新考虑:
我们这里打算通过system service来增加开机启动脚本:
vim /lib/systemd/system/rc-local.service
vim /lib/systemd/system/rc-local.service
#增加如下内容:
[Install]
WantedBy=multi-user.target
Alias=rc-local.service
创建启动执行脚本文件
sudo touch /etc/rc.local
sudo chmod +x /etc/rc.local
添加如下内容:
#!/bin/bash -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
sleep 30
echo "todo task"
exit 0
设置rc-local服务自动启动:
sudo systemctl enable rc-local
当前状态下自测试运行:
systemctl daemon-reload #重新加载
systemctl stop rc-local.service #停止rc-local.service服务
systemctl start rc-local.service #启动rc-local.service服务
systemctl status rc-local.service #检查服务状态