标签:就是 sys 开机 document emctl bsp mod etc use
$sudo vi /lib/systemd/system/rc-local.service
内容如下
[Unit]
Description=/etc/rc.local Compatibility
Documentation=man:systemd-rc-local-generator(8)
ConditionFileIsExecutable=/etc/rc.local
After=network.target
[Service]
Type=forking
ExecStart=/etc/rc.local start
TimeoutSec=0
RemainAfterExit=yes
GuessMainPID=no
[Install]
WantedBy=multi-user.target
Alias=rc-local.service
$sudo vi /etc/rc.local
内容如下
#!/bin/bash
echo "看到这行字,说明添加自启动脚本成功。" > /usr/local/test.log
exit 0
$sudo chmod +x /etc/rc.local
$sudo ln -s /lib/systemd/system/rc-local.service /etc/systemd/system/
$sudo systemctl enable rc-local
$sudo systemctl start rc-local
$sudo reboot now
没问题的话看一下 /usr/local/test.log的内容,正确就是工作正常了。
标签:就是 sys 开机 document emctl bsp mod etc use
原文地址:https://www.cnblogs.com/tochw/p/12942336.html