/etc/rc.d/rc.local配置文件

需要再系统启动时运行的工作,写入/etc/rc.d/rc.local配置文件即可。

/etc/rc.local与/etc/rc.d/rc.local的关系

/etc/rc.local —>rc.d/rc.local
(/etc/rc.local的链接文件指向/etc/rc.d/rc.local)

配置文件内容

[root@localhost ~]#vi /etc/rc.d/rc.local
#!/bin/sh

#This script will be executed after all the other init scripts.
#You can put your own initialization stuff in here if you don’t
#want to do the full Sys V style init stuff.
touch /var/lock/subsys/local
#默认会touch这个文件,每次系统启动时都会touch这个文件,这个文件的修改时间就是系统的启动时间
#写入想要启动系统并运行的语句
#例1:
/etc/rc.d/init.d/httpd start
#如果写入RPM包安装的apache服务的启动命令,apache服务就会在开机时自动启动
#例2:
[ -f /usr/local/gse/proxy/bin/gsectl ] && /usr/local/gse/proxy/bin/gsectl start > /var/log/gse_start.log 2>&1
#某系统的开机自启设置

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐