ubuntu16.10没有/etc/rc.local 文件了,开机时候希望执行的命令添加到哪里

系统安装、升级讨论
版面规则
我们都知道新人的确很菜,也喜欢抱怨,并且带有浓厚的Windows习惯,但既然在这里询问,我们就应该有责任帮助他们解决问题,而不是直接泼冷水、简单的否定或发表对解决问题没有任何帮助的帖子。乐于分享,以人为本,这正是Ubuntu的精神所在。
回复
ims_
帖子: 3
注册时间: 2016-11-06 19:44
系统: ubuntu

ubuntu16.10没有/etc/rc.local 文件了,开机时候希望执行的命令添加到哪里

#1

帖子 ims_ » 2016-11-06 20:31

以前往这个脚本中添加亮度设置,网络配置的信息,,现在没这个文件了,保存亮度都解决不了了,是不是16.10版本有别的开机脚本,可以往里面添加命令,或则有别的方法保存亮度,。
头像
vickycq
帖子: 4507
注册时间: 2011-03-20 13:12
系统: Debian
来自: 山东省寿光县
联系:

Re: ubuntu16.10没有/etc/rc.local 文件了,开机时候希望执行的命令添加到哪里

#2

帖子 vickycq » 2016-11-06 22:43

1. 自行创建 /etc/rc.local 添加以下默认内容

代码: 全选

#!/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.

exit 0
2. 在 exit 0 之前加入自定义内容

3. 执行以下命令确保 rc.local 开机自启

代码: 全选

sudo chown root:root /etc/rc.local
sudo chmod 755 /etc/rc.local
sudo systemctl enable rc-local.service
Debian 中文论坛 - forums.debiancn.org
欢迎所有 Debian GNU/Linux 用户
ims_
帖子: 3
注册时间: 2016-11-06 19:44
系统: ubuntu

Re: ubuntu16.10没有/etc/rc.local 文件了,开机时候希望执行的命令添加到哪里

#3

帖子 ims_ » 2016-11-07 12:30

ims@ims-HP:~$ sudo chown root:root /etc/rc.local
[sudo] password for ims:
ims@ims-HP:~$ sudo chmod 755 /etc/rc.local
ims@ims-HP:~$ sudo systemctl enable rc-local.service
Failed to enable unit: Invalid argument

这是什么情况?
ims_
帖子: 3
注册时间: 2016-11-06 19:44
系统: ubuntu

Re: ubuntu16.10没有/etc/rc.local 文件了,开机时候希望执行的命令添加到哪里

#5

帖子 ims_ » 2016-11-07 18:47

:Adore
sluding
帖子: 70
注册时间: 2010-02-12 19:47

Re: ubuntu16.10没有/etc/rc.local 文件了,开机时候希望执行的命令添加到哪里

#6

帖子 sluding » 2016-11-09 9:21

vickycq 写了: 2. 在 exit 0 之前加入自定义内容
不加 exit 0 有什么严重后果么
回复