1
2
3
4
5
6
7
8
9
10
11
12
13
14
vi /lib/systemd/system/rc.local.service

[Unit]
Description=/etc/rc.local Compatibility
ConditionFileIsExecutable=/etc/rc.local
After=network.target

[Service]
Type=forking
ExecStart=/etc/rc.local start
TimeoutSec=0
RemainAfterExit=yes


尾部添加内容

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
[Unit]
Description=/etc/rc.local Compatibility
ConditionFileIsExecutable=/etc/rc.local
After=network.target

[Service]
Type=forking
ExecStart=/etc/rc.local start
TimeoutSec=0
RemainAfterExit=yes


[Install]
WantedBy=multi-user.target
Alias=rc-local.service

新建文件

1
vi /etc/rc.local 

软链

1
ln -s /lib/systemd/system/rc.local.service /etc/systemd/system/