---
title: "CentOS系统rc.local文件配置"
author: "listen-raining"
date: "2016-12-31T11:43:08Z"
tags: []
categories: ["操作系统"]
slug: "centos-rc-local"
draft: false
lastmod: "2016-12-31T11:43:08Z"
id: 2348319
url: "https://listen-raining.iteye.com/blog/2348319"
---

CentOS系统rc.local文件配置

公司让分别在两台主机上配置启动脚本，即当系统重启的时候，随系统自动执行的启动脚本。

两台主机的操作系统分别是CentOS6.5 和 CentOS7,版本不一样。

在6.5版本的主机上配置后，可以正常启动，但是7.0版本的不行，原因是7.0版的rc.local文件默认是没有执行权限的，需要手工添加。



cd /etc/rc.d
chmod +x rc.local


rc.local文件配置：
su -c '/mondev/mondo/client/bin/magent restart' mondev &



CentOS操作系统查看版本信息命令：

[root@localhost ~]# rpm -q centos-release
centos-release-7-1.1503.el7.centos.2.8.x86_64

                                                            2016-12-31 11:47
                 fudoucheng.jiejinzhonglu.shiqiao.panyuqu.guangzhoushi.guangdongsheng