当前位置:网站首页>/etc/rc.local 设置UI程序开机自启动
/etc/rc.local 设置UI程序开机自启动
2022-07-24 05:16:00 【lifei_0001】
与Windows不同,Linux的桌面系统只是运行在内核上的一个软件(Windows桌面是与内核是一体的),和其他软件并无区别。桌面软件是在用户用桌面登录时开启的,所以Linux下的UI程序必须要开启桌面的账户才能有权限开启。
设置UI程序开机启动的脚本有很多,比如在桌面设置中使用desktop、自己写个自启动的服务、利用Linux的定时任务等,在这里我们讨论利用/etc/rc.local的方案。
/etc/rc.local 脚本是系统启动时最后开启的一个脚本,权限是root,如果要启动UI程序首先需要切换用户。
例如我当前桌面登录用户是pi, 开启UI程序的脚本是start.sh。
在rc.local中加入su - pi -c 'echo "pi"|sudo /home/pi/start.sh'
su - pi -c '命令':单引号里是启动脚本命令;
sudo /home/pi/start.sh :sudo权限开启脚本;
echo “pi” | :向sudo传递密码,密码是pi;
ps:UI程序必然是要运行在显示器上的,所以在启动程序脚本里记得设置显示的设备位置。一般设置环境变量“export DISPLAY=:0.0”。
边栏推荐
- Echo speaker pairing and operation method
- 【深度学习】(三)图像分类
- Tips for using BeanShell built-in variable prev
- 纯小白教程 在idea里使用Druid数据库连接池
- How to avoid the most common mistakes when building a knowledge base?
- MySQL connection
- Pointer learning diary (I)
- C语言进阶篇 一.数据的存储
- Tips for using the built-in variable props of BeanShell
- C语言入门篇 二.函数
猜你喜欢

纯小白教程 在idea里使用Druid数据库连接池

C语言从入门到入土(三)

AiN 0722 签到

Echo speaker pairing and operation method

SSM integration
![Knowledge record of College Physics C in advance in summer [update]](/img/c4/76b669c3229a365a5e2567f7fb824e.png)
Knowledge record of College Physics C in advance in summer [update]

【深度学习】(三)图像分类

AttributeError: ‘NoneType‘ object has no attribute ‘shape‘

DNS domain name resolution service

FTP file transfer protocol
随机推荐
OSS file upload
ZY: modify host name
reflex
Hotel IPTV digital TV system solution
C table data De duplication
View progress!!! RPM installation!!!
On the dilemma faced by non transferable reputation points NFT SBTS
Machine vision learning summary
好的程序员与不好的程序员
C语言从入门到入土——操作符超详细总结
AiN 0722 签到
【sklearn】数据预处理
Source code compilation!!
JSP+Dao整合
文本摘要 ACL2021
泛型和注解
jdbc的增删改查
Handwritten ORM framework
C语言进阶篇 四.自定义类型详解
c2-随机产生函数种子seed、numpy.random.seed()、tf.random.set_seed学习+转载整理