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


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值