debian 9、10开启rc.local

新建vi /etc/rc.local内容2行:

#!/bin/sh -e

exit 0

chmod u+x /etc/rc.local

开机启动

root@debian10:~# systemctl enable rc.local  这一步不成功,实际上这一步也不影响reboot后,rc.local的开机启动

The unit files have no installation config (WantedBy=, RequiredBy=, Also=,
Alias= settings in the [Install] section, and DefaultInstance= for template
units). This means they are not meant to be enabled using systemctl.

Possible reasons for having this kind of units are:
• A unit may be statically enabled by being symlinked from another unit's
  .wants/ or .requires/ directory.
• A unit's purpose may be to act as a helper for some other unit which has
  a requirement dependency on it.
• A unit may be started when needed via activation (socket, path, timer,
  D-Bus, udev, scripted systemctl call, ...).
• In case of template units, the unit is meant to be enabled with some
  instance name specified

reboot后,rc.local正常开机启动

实际上rc.local.servie和rc-local.service是一个服务

posted @ 2020-12-04 04:44  helloweifa  阅读(1401)  评论(0编辑  收藏  举报