分页: 1 / 1

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

发表于 : 2016-11-06 20:31
ims_
以前往这个脚本中添加亮度设置,网络配置的信息,,现在没这个文件了,保存亮度都解决不了了,是不是16.10版本有别的开机脚本,可以往里面添加命令,或则有别的方法保存亮度,。

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

发表于 : 2016-11-06 22:43
vickycq
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

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

发表于 : 2016-11-07 12:30
ims_
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

这是什么情况?

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

发表于 : 2016-11-07 13:04
bzimage
mark :Music

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

发表于 : 2016-11-07 18:47
ims_
:Adore

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

发表于 : 2016-11-09 9:21
sluding
vickycq 写了: 2. 在 exit 0 之前加入自定义内容
不加 exit 0 有什么严重后果么