T507 Ubuntu系统开机自启脚本

编程入门 行业动态 更新时间:2024-10-10 23:22:56

T507 Ubuntu系统开机自启<a href=https://www.elefans.com/category/jswz/34/1771291.html style=脚本"/>

T507 Ubuntu系统开机自启脚本

全志T507 Ubuntu系统开机自启脚本是rc.local ,客户如果直接修改rc.local 文件,启机后存在修改的内容不生效的问题。具体原因和修改方法如下:

18.04及以上系统取消了rc.local自启动功能,因此不能像ubuntu16一样通过编辑rc.local来设置开机启动脚本。所以我们需要先打开rc.local自启动功能。

1、建立rc-local.service文件

sudo vim /etc/systemd/system/rc-local.service
输入如下内容
[Unit]
Description=/etc/rc.local Compatibility
ConditionPathExists=/etc/rc.local

[Service]
Type=forking
ExecStart=/etc/rc.local start
TimeoutSec=0
StandardOutput=tty
RemainAfterExit=yes
SysVStartPriority=99

[Install]
WantedBy=multi-user.target

2、创建rc.local
sudo vim /etc/rc.local

输入如下内容,注意加入sshd服务启动
#!/bin/sh -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.**

echo “rc.local start” > /usr/local/test.log
/etc/init.d/ssh start
source ~/.bashrc
exit 0

3、给rc.local加上权限
sudo chmod +x /etc/rc.local

4、启用服务
sudo systemctl enable rc-local

待您成功开启rc.local 自启功能之后,您再对rc.local开机自启脚本进行修改,保存后重启T507开发板,测试修改是否生效。

本文硬件平台采用飞凌T507开发板,主要讲解T507客户ubuntu系统下设置开机自启脚本,当直接修改rc.local 文件,T507 Ubuntu系统启机后存在修改的内容不生效的问题的解决思路及方法。本文使用的思路和方法仅供参考使用,其它arm开发板虽然芯片不同,但思路和方法有很多的共性,希望对您在板卡的使用中能够有所帮助,更多ARM开发板相关资讯,关注飞凌嵌入式。

更多推荐

T507 Ubuntu系统开机自启脚本

本文发布于:2024-03-14 12:17:27,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1736452.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:脚本   系统   Ubuntu

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!