centos7 rc.local無效

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


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章