最近发现centos7 的/etc/rc.local不会开机执行,于是认真看了下/etc/rc.local文件内容的就发现了问题的原因了

1
2
3
4
5
6
7
8
9
10
11
#!/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.

翻译:

1
2
3
4
5
6
7
#这个文件是为了兼容性的问题而添加的。
#
#强烈建议创建自己的systemd服务或udev规则来在开机时运行脚本而不是使用这个文件。
#
#与以前的版本引导时的并行执行相比较,这个脚本将不会在其他所有的服务后执行。
#
#请记住,你必须执行“chmod +x /etc/rc.d/rc.local”来确保确保这个脚本在引导时执行。

于是我有确认了下/etc/rc.local的权限

1
2
3
4
[root@localhost ~]# ll /etc/rc.local
lrwxrwxrwx. 1 root root 13 8月  12 06:09 /etc/rc.local -> rc.d/rc.local
[root@localhost ~]# ll /etc/rc.d/rc.local
-rw-r--r--. 1 root root 477 6月  10 13:35 /etc/rc.d/rc.local

/etc/rc.d/rc.local没有执行权限,于是按说明的内容执行

1
chmod +x /etc/rc.d/rc.local

重启后发现/etc/rc.local能够执行了。

看样子是版本的变迁,/etc/rc.local /etc/rc.d/rc.local正在弃用的路上。

本文出自 “闲潭小筑” 博客,请务必保留此出处http://soarwilldo.blog.51cto.com/5520138/1549656

centos 7 /etc/rc.local 开机不执行的问题的更多相关文章

  1. (转)CentOS 7 —— /etc/rc.local 开机不执行 - 解决方法

    chmod +x /etc/rc.d/rc.localsystemctl enable rc-local.service Note: rc.local is obsolete. ----------- ...

  2. centos 7.1开机/etc/rc.local脚本不执行的问题

    Centos 7.1中,/etc/rc.local是一个软链接文件.指向的是/etc/rc.d/rc.local 在Centos之前的版本我们都会将一些开机需要执行的命令加入到/etc/rc.loca ...

  3. Ubuntu 16.04设置rc.local开机启动命令/脚本的方法

    Ubuntu 16.04设置rc.local开机启动命令/脚本的方法       Ubuntu 16.04设置rc.local开机启动命令/脚本的方法(通过update-rc.d管理Ubuntu开机启 ...

  4. centos7设置rc.local开机执行命令

    在Centos7下,rc.local文件,开机默认是不执行的 它是个软链接 [root@data-1-1 ~]# ll /etc/rc.local lrwxrwxrwx. 1 root root 13 ...

  5. CentOS7 rc.local开机开法启动

    CentOS 7添加开机启动服务/脚本 一.添加开机自启服务 在CentOS 7中添加开机自启服务非常方便,只需要两条命令(以Jenkins为例):systemctl enable jenkins.s ...

  6. Ubuntu 16.04设置rc.local开机启动命令/脚本的方法(通过update-rc.d管理Ubuntu开机启动程序/服务)

    注意:rc.local脚本里面启动的用户默认为root权限. 一.rc.local脚本 rc.local脚本是一个Ubuntu开机后会自动执行的脚本,我们可以在该脚本内添加命令行指令.该脚本位于/et ...

  7. 配置rc.local开机自启动文件的疑问

    有时我们自己在/etc/rc.d/rc.local里面增加的随机器启动的脚本和指令总是不能自动加载和启动,,机器启动后手动执行脚本又能成功,经常被搞得晕头转向的.最近我经过1天的辛苦测试和查找资料,终 ...

  8. 问题汇总-20130927-关于rc.local命令无法执行

    场景:/etc/rc.local有语句 /usr/local/apache/bin/apachectl start mysql cactidb -u root -p123456 -e ' set gl ...

  9. Debian 9.x "stretch" 解决 /etc/rc.local 开机启动问题

    由于某些软件并没有增加开启启动的服务,很多时候需要手工添加,一般我们都是推荐添加命令到 /etc/rc.local 文件,但是 Debian 9 默认不带 /etc/rc.local 文件,而 rc. ...

随机推荐

  1. ElasticSearch介绍 【未完成】

    ElasticSearch应用于搜索是一个不错的选择,虽有Lucene,但ELK的搜索方便. http://joelabrahamsson.com/elasticsearch-101/ 一.下载 ht ...

  2. iOS 关于nil和Nil及null与<null>的区别

    问题是这样的. NSDictionary *sample = [NSJSONSerialization JSONObjectWithData:received options:NSJSONReadin ...

  3. [2013 Final] Colors

    Description Ziyao has a big drawing board with N * M squares. At the beginning, all the squares on t ...

  4. gromacs, quake III和vrsqrtps

    看标题大家可能觉得三个词汇风马牛不相及,第一个是解蛋白质分子动力学的软件,第二个是上三代宅男最爱雷神之锤,第三个则是一个存在于IntelSSE及AVX中的一个指令,他的作用是快速求平方根的倒数. 起因 ...

  5. Hadoop-1.2.1 安装步骤小结(ubuntu)

    1.安装ubuntu系统 如果不使用云服务器,可以使用虚拟机WmWare安装,具体安装步骤这里就不讲了,ubuntu系统下载地址:http://www.ubuntu.com/download/desk ...

  6. 在SSMS里批量删除表、存储过程等各种对象

    在SSMS里批量删除表.存储过程等各种对象 以前想找批量删除表或者存储过程的方法,原来SSMS的GUI界面也可以完成 请看下图,因为这次出差的时候要删除所有的存储过程,然后重建这些存储过程 而表.函数 ...

  7. C# 截取字符串方法(包含中英混合)

    private string GetByteString(string center, int maxlen, string endStr) { , (center.Length < maxle ...

  8. python 列表生成器

    python 列表生成器 列表生成式即List Comprehensions,是Python内置的非常简单却强大的可以用来创建list的生成式. 一个循环 在C语言等其他语言中,for循环一般是这样的 ...

  9. CSS 冲击波(水波纹)效果

    <span style="font-size:18px;"><!DOCTYPE html> <html> <head> <me ...

  10. H5 Canvas刮刮乐

    玩游戏的人 很多时候都会遇到翻牌子  开宝箱. 总有人傻傻的在哪里还纠结很久到底点哪一个! 纠结  指不定翻哪一个会多一点,你明明看到那个卡片的奖项多 . 那我就告诉你好了  其实很多时候在你点开那个 ...