centos7 rc.local无效

来源:互联网 发布:mac上文件变成exe 编辑:程序博客网 时间:2024/05/24 05:24

1 给 /etc/rc.d/rc.local 可执行权限:

chmod +x /etc/rc.d/rc.local

2   开启 rc-local.service 服务:

systemctl   enable   rc-local.service

systemctl   start  rc-local.service

3.Systemctl enable rc-loacl.service 如果不成功,就按如下修改 rc-local.service

systemctl enable rc-local.service
The unit files have no [Install] section. They are not meant to be enabled
using systemctl.
Possible reasons for having this kind of units are:
1) A unit may be statically enabled by being symlinked from another unit's
  .wants/ or .requires/ directory.
2) A unit's purpose may be to act as a helper for some other unit which has
  a requirement dependency on it.
3) A unit may be started when needed via activation (socket, path, timer,
  D-Bus, udev, scripted systemctl call, ...).

4.Vi /lib/system/system/rc-local.service

[Install]

WantedBy=multi-user.target

5.ln -s '/lib/systemd/system/rc-local.service' '/etc/systemd/system/multi-user.target.wants/rc-local.service'

6.systemctl enable rc-local.service

7.Systemctl start rc-local.service


0 0
原创粉丝点击