在uos操作系统中,rc.local对应的服务是rc-local
################################################################
大致过程:
1、安装rc-local服务
2、修改rc.local.service配置文件
3、配置rc.local
4、测试验证
################################################################
1、安装rc-local服务
# apt -y install rc-local
# systemctl enable rc-local
# systemctl start rc-local
2、修改配置文件rc.local.service
# vi /usr/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
3、配置rc-local
如果没有自动生成rc.local文件,创建一个就可以了
# vi /etc/rc.local
         #!/bin/bash
         touch /123.txt        # 用于测试
         exit 0           # 在exit 0之前增加需要开机启动的服务、脚本等
     # chmod + x /etc/rc.local         # 赋权权限
4、测试是否生效(或者重启系统验证)
     # sudo /etc/rc.local
     # ls /










