mysql etc rc.local_CentOS 7 开机启动自定义配置文件:/etc/rc.local 不执行解决办法 | IT运维网...
最近在安裝程序時(shí)發(fā)現(xiàn)CentOS 7的開(kāi)機(jī)自定義配置文件(/etc/rc.local)內(nèi)配置了啟動(dòng)腳本不會(huì)開(kāi)機(jī)執(zhí)行;于是查看了下配置文件內(nèi)容發(fā)現(xiàn)了問(wèn)題的原因
[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
上面的意思說(shuō)這個(gè)文件是為了兼容性的問(wèn)題而添加的,建議創(chuàng)建自己的systemd服務(wù)或udev規(guī)則來(lái)在開(kāi)機(jī)時(shí)運(yùn)行腳本而不是使用這個(gè)文件;與以前的版本引導(dǎo)時(shí)的并行執(zhí)行相比較,這個(gè)腳本將不會(huì)在其他所有的服務(wù)后執(zhí)行;必須執(zhí)行“chmod +x /etc/rc.d/rc.local”來(lái)確保這個(gè)腳本在引導(dǎo)時(shí)執(zhí)行。
于是查看權(quán)限時(shí)發(fā)現(xiàn)/etc/rc.d/rc.local文件并沒(méi)有執(zhí)行權(quán)限
[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
因此按照提示配置執(zhí)行權(quán)限并查驗(yàn)
[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
通過(guò)以上配置這個(gè)問(wèn)題得以解決
與50位技術(shù)專(zhuān)家面對(duì)面20年技術(shù)見(jiàn)證,附贈(zèng)技術(shù)全景圖總結(jié)
以上是生活随笔為你收集整理的mysql etc rc.local_CentOS 7 开机启动自定义配置文件:/etc/rc.local 不执行解决办法 | IT运维网...的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: centos7安装mysql8.0简书_
- 下一篇: mysql got signal 6_U