`
itace
  • 浏览: 178322 次
  • 性别: Icon_minigender_1
  • 来自: 北京
文章分类
社区版块
存档分类
最新评论

/etc/rc.local 和/etc/init.d/rc.local的区别

 
阅读更多

从下面的命令注释内容可以看出,/etc/init.d/rc.local里面会判断是否存在/etc/rc.local,如果存在,就执行这个文件

 

 

/etc/rc.local的内容如下: cat /etc/rc.local 

 

 

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

exit 0

 

 

 

/etc/init.d/rc.local的内容如下: cat /etc/init.d/rc.local 

 

 

#! /bin/sh
### BEGIN INIT INFO
# Provides:          rc.local
# Required-Start:    $all
# Required-Stop:
# Default-Start:     2 3 4 5
# Default-Stop:
# Short-Description: Run /etc/rc.local if it exist
### END INIT INFO


PATH=/sbin:/usr/sbin:/bin:/usr/bin

. /lib/init/vars.sh
. /lib/lsb/init-functions

do_start() {
	if [ -x /etc/rc.local ]; then
	        [ "$VERBOSE" != no ] && log_begin_msg "Running local boot scripts (/etc/rc.local)"
		/etc/rc.local
		ES=$?
		[ "$VERBOSE" != no ] && log_end_msg $ES
		return $ES
	fi
}

case "$1" in
    start)
	do_start
        ;;
    restart|reload|force-reload)
        echo "Error: argument '$1' not supported" >&2
        exit 3
        ;;
    stop)
        ;;
    *)
        echo "Usage: $0 start|stop" >&2
        exit 3
        ;;
esac

 

 

<audio controls="controls" style="display: none;"></audio>

分享到:
评论

相关推荐

    ubuntu系统中/etc/rc.local和/etc/init.d/rc.local的区别详解

    分别是/etc/rc.local和/etc/init.d/rc.local。可以看一下两个文件的内容找到他俩的关系: /etc/init.d/rc.local #! /bin/sh ### BEGIN INIT INFO # Provides: rc.local # Required-Start: $all # Required-Stop: ...

    Nginx通过/etc/init.d/nginx方式启停【nginx配置文件】

    vi /etc/init.d/nginx 修改nginx后 chmod +x /etc/init.d/nginx /sbin/chkconfig nginx on sudo /sbin/chkconfig --list nginx /etc/init.d/nginx start

    rc.local自启动学习.doc

    ln -sf ../init.d/apache ../rc0.d/K28apache ln -sf ../init.d/apache ../rc1.d/K28apache ln -sf ../init.d/apache ../rc2.d/K28apache ln -sf ../init.d/apache ../rc3.d/S32apache ln -sf ../init.d/apache ../...

    linux自启动设置.txt

    ln -sf ../init.d/apached ../rc3.d/S32apached ln -sf ../init.d/apached ../rc4.d/S32apached ln -sf ../init.d/apached ../rc5.d/S32apached ln -sf ../init.d/apached ../rc6.d/K28apached ``` 这里,`S32`表示...

    linux etc/rc.d 系统启动服务详解

    在Linux操作系统中,`/etc/rc.d` 是一个非常重要的目录,它包含了系统启动时运行的各种脚本和服务配置。这个目录是基于传统的init系统的一部分,主要用于管理系统的启动、停止、重启以及服务的控制。让我们深入了解...

    linux自启动设置方法

    ln -sf ../init.d/apache ../rc3.d/S32apache && ln -sf ../init.d/apache ../rc4.d/S32apache && ln -sf ../init.d/apache ../rc5.d/S32apache && ln -sf ../init.d/apache ../rc6.d/K28apache ``` #### 四、rc....

    SUSE Linux下开机自动运行脚本命令的方法

    3. **/etc/rc.d/before.local**:此文件也需要手动创建,并且在系统进入运行级别之前执行,但其执行时间点比`boot.local`晚。同样地,此时网络等设备仍未就绪。 对于大多数需要开机自动执行的程序或脚本而言,推荐...

    ubuntu 8.0.4 server 安装oracle10.2成功

    sudo ln -s /etc/init.d /etc/rc.d/init.d ``` #### 七、设置系统参数 为了优化系统性能,需要调整一些关键的系统参数。 1. 编辑`/etc/sysctl.conf`文件: ```bash fs.file-max = 65536 kernel.shmall = ...

    linux 开机自动启动脚本方法.doc

    除了直接在rc.local文件中添加脚本之外,还可以将自己的脚本复制到/etc/rc.d/init.d/目录下,并在相应的模式下添加链接。例如,可以查看当前的脚本顺序,使用ls -la命令来查看当前的脚本顺序,然后将自己的脚本添加...

    Centos7.6/7.9系统安装DELL OMSA说明

    echo '/opt/dell/srvadmin/sbin/srvadmin-services.sh start' &gt;&gt; /etc/rc.local 七、使用 OMSA 使用浏览器登录以下地址: https://系统IP:1311 用户名和密码是该服务器的用户名密码(非远程管理卡的密码)。 ...

    解决centos7 开机/etc/rc.local 不执行的问题

    最近发现centos7 的/etc/rc.local不会开机执行,于是认真看了下/etc/rc.local文件内容的就发现了问题的原因了 #!/bin/bash # THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES # # It is highly advisable to create...

    thin-rc.d:简单的FreeBSD rc脚本精简

    '/etc/rc.d/thin' : '/etc/init.d/thin' 薄的rubygem-thin也不提供rc.d脚本。安装下载rc.d脚本,使其可执行,将其放置在/usr/local/etc/rc.d/ ,获利$$。 mkdir -p /usr/local/etc/rc.dcd /usr/local/etc/rc.d/...

    Linux系统启动引导程序配置文件解析

    对于本地启动脚本,通常可以在`/etc/rc.d/rc.local`、`/etc/init.d/boot.local`或`/etc/rc.boot`找到。 网络配置在Linux系统启动过程中也至关重要。`/sbin/ifup`脚本用于设置网络接口,网络配置数据存储在`/etc/...

    Postfix安装

    # ln -s /etc/rc.d/init.d/mysqld /etc/rc.d/rc3.d/S99mysqld # ln -s /etc/rc.d/init.d/mysqld /etc/rc.d/rc3.d/K99mysqld # ln -s /etc/rc.d/init.d/mysqld /etc/rc.d/rc5.d/S99mysqld # ln -s /etc/rc.d/init.d/...

    在linux下设置开机自动启动程序的方法.pdf

    例如,可以在 /etc/rc.d/rc.local 文件中添加一行命令,以便在开机启动后直接进入 X-Window。 登录时自动运行程序 在 Linux 中,可以通过在 /etc/profile 文件中添加命令来实现登录时自动运行程序。用户登录时,...

    linux设置tomcat开机自动启动1

    在Linux系统中,确保应用程序如Apache Tomcat在开机时自动启动是系统管理的重要部分,特别是对于提供持续服务的服务器来说。...但在这里,我们主要关注基于`rc.local`或者`/etc/init.d`的传统方法。

    linux下设置开机自动启动程序.doc

    包括在 /etc/rc.d/rc.local 中增加启动命令、将 apache 注册为系统服务、在 Red Hat Linux 中自动运行程序、登录时自动运行程序、退出登录时自动运行程序、定期自动运行程序和定时自动运行程序等多种方法。...

    linux设置Oracle开机自动启动.docx

    - **执行权限的重要性**:确保`/etc/oratab` 和`/etc/rc.d/rc.local` 文件具有正确的执行权限是非常重要的。这是因为Linux系统会根据文件的权限决定是否执行脚本中的命令。 - **设置执行权限**:可以使用`chmod`命令...

Global site tag (gtag.js) - Google Analytics