mysql etc rc.local_CentOS 7 开机启动自定义配置文件:/etc/rc.local 不执行解决办法 | IT运维网...
最近在安裝程序時發現CentOS 7的開機自定義配置文件(/etc/rc.local)內配置了啟動腳本不會開機執行;于是查看了下配置文件內容發現了問題的原因
[root@localhost ~]# cat /etc/rc.local
#!/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 contrast 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.
touch /var/lock/subsys/local
上面的意思說這個文件是為了兼容性的問題而添加的,建議創建自己的systemd服務或udev規則來在開機時運行腳本而不是使用這個文件;與以前的版本引導時的并行執行相比較,這個腳本將不會在其他所有的服務后執行;必須執行“chmod +x /etc/rc.d/rc.local”來確保這個腳本在引導時執行。
于是查看權限時發現/etc/rc.d/rc.local文件并沒有執行權限
[root@localhost ~]# ll /etc/rc.local
lrwxrwxrwx. 1 root root 13 Feb 3 23:29 /etc/rc.local -> rc.d/rc.local
[root@localhost ~]# ll /etc/rc.d/rc.local
-rw-r--r--. 1 root root 473 Feb 1 04:53 /etc/rc.d/rc.local
因此按照提示配置執行權限并查驗
[root@localhost ~]# chmod +x /etc/rc.d/rc.local
[root@localhost ~]# ll /etc/rc.local
lrwxrwxrwx. 1 root root 13 Feb 3 23:29 /etc/rc.local -> rc.d/rc.local
[root@localhost ~]# ll /etc/rc.d/rc.local
-rwxr-xr-x. 1 root root 473 Feb 1 04:53 /etc/rc.d/rc.local
通過以上配置這個問題得以解決
與50位技術專家面對面20年技術見證,附贈技術全景圖總結
以上是生活随笔為你收集整理的mysql etc rc.local_CentOS 7 开机启动自定义配置文件:/etc/rc.local 不执行解决办法 | IT运维网...的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: centos7安装mysql8.0简书_
- 下一篇: mysql got signal 6_U