赋予rc.local运行权限:chmod +x /etc/rc.d/rc.local
创建运行脚本:vim auto_run_script.sh
#!/bin/bash
ntpdate time.windows.com
ntpdate -u ntp.api.bz
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
echo 'Asia/Shanghai' > /etc/timezone
systemctl stop firewalld
systemctl restart docker
保存退出后,再给它赋予可执行权限:chmod +x auto_run_script.sh
脚本添加到 /etc/rc.d/rc.local 文件最后一行:
$ vi /etc/rc.d/rc.local
/home/auto_run_script.sh
5、重启系统就可以了:
sudo reboot