Home
Categories
WIKI
Topic
User
LANGUAGE:
中文
English
deepin 开机自启动脚本之 rc.local
Experiences and Insight
3195
views ·
3
replies ·
To
floor
Go
heisen
deepin
2019-12-05 01:37
Author
众所周知debian系发行版本中貌似没有/etc/rc.local
这给很多小伙伴带来了很多困扰,没有rc.local 开机怎么自动执行命令呢??
这个问题也困扰了我很久,但是已经被我解决了,现在贴出来分享给大家
打开终端执行下面命令,会在 /etc 下生成 rc.local 文件,每次开机系统会执行脚本内的命令
您只需要在/etc/rc.local 文件中 exit 0 字段前添加您的命令,在下次开机时便会自动执行
### debian系linux(debian、ubuntu、deepin),开机自启动脚本之 /etc/rc.local
### 全选复制粘贴到终端执行
sudo touch /etc/init.d/rc.local
sudo chmod 777 /etc/init.d/rc.local
echo '''#!/bin/sh
### BEGIN INIT INFO
# Provides: skeleton
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Should-Start: $portmap
# Should-Stop: $portmap
# X-Start-Before: nis
# X-Stop-After: nis
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# X-Interactive: true
# Short-Description: Example initscript
# Description: This file should be used to construct scripts to be
# placed in /etc/init.d.
### END INIT INFO
########### scripts velues ############
#######################################
exit 0 ''' >> /etc/init.d/rc.local
sudo update-rc.d rc.local defaults
sudo ln -s /etc/init.d/rc.local /etc/
echo '已生成/etc/rc.local启动文件'
Copy the Code
注意:请勿删除#号开头注释内容,否则会遇到问题!!!
Reply
Like 1
Favorite
View the author
All Replies
heisen
deepin
2019-12-05 01:40
#1
占楼备用!!!
Reply
Like 0
View the author
foxbcd
deepin
2019-12-05 02:10
#2
不都是用 systemd 的吗?
Reply
Like 0
View the author
RedPanda
deepin
2019-12-05 17:10
#3
systemd貌似是debian系的解决方案。而且我个人觉得systemd更方便一点....
Reply
Like 1
View the author
Please
sign
in first
Featured Collection
Change
[Tutorial] deepin25 WSL Offline Installation Guide
UOS AI 2.8 Released! Three New Intelligent Agents & Major Evolution
Solid Q&A | deepin 25 Common Questions – The Immutable System Edition
New Thread
Popular Ranking
Change
WiFi Drivers
Popular Events
More
这给很多小伙伴带来了很多困扰,没有rc.local 开机怎么自动执行命令呢??
这个问题也困扰了我很久,但是已经被我解决了,现在贴出来分享给大家
打开终端执行下面命令,会在 /etc 下生成 rc.local 文件,每次开机系统会执行脚本内的命令
您只需要在/etc/rc.local 文件中 exit 0 字段前添加您的命令,在下次开机时便会自动执行
注意:请勿删除#号开头注释内容,否则会遇到问题!!!