Ubuntu 16.10没有rc.local文件

Google查了下,原来是1610把rc.local服务化了,看来systemd已经决心独立了。。话说这个sysvinit流传的下来的东东生命力确实顽强,而且真的很好用啊。

解决方法:

首先创建systemd的服务脚本

1、sudo vi /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
#sysVstart这行可以删掉,我看启动日志中貌似报忽略这个了。。
 
[Install]
 WantedBy=multi-user.target

2、sudo systemctl enable rc-local.service

然后就按以前的格式编辑/etc/rc.local就好了。

最后记得chmod +x /etc/rc.local

补充:Ubuntu 16.10的网卡名更换

编辑/etc/default/grub

GRUB_CMD_LINUX="net.ifname=0  biosdevname=0"

然后

sudo grub-mkconfig -o /boot/grub/grub.cfg

后记:systemd的时代已经来临,是时候学一波systemd服务脚本编写了。

猜你喜欢

转载自www.linuxidc.com/Linux/2016-12/138664.htm