1.首先创建systemd的服务脚本

sudo vi /etc/systemd/system/rc-local.service

[Unit]
Description=/etc/rc.local Compatibility
ConditionPathExists=/etc/rc.local
[Service]
Type=forking
ExecStart=/etc/rc.local start
TimeoutSec=0
StandardOutput=tty
RemainAfterExit=yes
SysVStartPriority=99
[Install]
WantedBy=multi-user.target

2.创建脚本

sudo touch /etc/rc.local
chmod 755 /etc/rc.local

sudo echo "#!/bin/bash" > /etc/rc.local

3.加入系统服务

systemctl enable rc-local.service

 

相关文章:

  • 2021-09-21
  • 2021-12-12
  • 2021-08-09
  • 2022-12-23
  • 2022-12-23
  • 2021-11-05
  • 2022-12-23
猜你喜欢
  • 2021-07-27
  • 2021-12-10
  • 2021-10-29
  • 2022-12-23
  • 2022-12-23
  • 2022-03-09
相关资源
相似解决方案