QUOTE:
#!/bin/bash
# THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES
#
# It is highly advisable to create own systemd services or udev rules
# to run scripts during boot instead of using this file.
#
# In constrast to previous versions due to parallel execution during boot
# this script will NOT be run after all other services.
#
# Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure
# that this script will be executed during boot.
可以看到這個檔案在 RHEL 及 CentOS 7 只為了解決兼容性, Redhat 建議還是自行建立 systemd 服務或者 udev rules 較好, 如果真的需要使用 rc.local, 只要執行 chmod 給予 rc.local 可執行權限即可:
# chmod +x /etc/rc.d/rc.local
執行以上指令後, 下次開機便會自動執行 rc.local 內的指令或 Shell Script.