Debian/Ubuntu开启rc.local

2024 年 8 月 1 日 星期四
35
1

Debian/Ubuntu开启rc.local

执行以下shell即可

sudo cat <<'TEXT' > /etc/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.sercice
TEXT
systemctl daemon-reload #重新加载配置
systemctl enable rc-local.service #配置开机启动
  • Loading...
  • Loading...
  • Loading...
  • Loading...
  • Loading...