banner
李大仁博客

李大仁博客

天地虽大,但有一念向善,心存良知,虽凡夫俗子,皆可为圣贤。

CentOS6 uses rc.local to achieve automatic startup on boot.

title: "CentOS6 Using rc.local for Boot Startup"
date: "2018-11-09"
categories:

  • "system management"
    tags:
  • "centos"
  • "linux"

In CentOS6, you can add a startup shell script to rc.local to enable automatic startup.

Assuming you need to start:

/usr/share/autostartup/demo-service.sh

STEP1. Set the script that needs to be started as an executable file.

chmod +x /usr/share/autostartup/demo-service.sh

STEP2. Execute the following command to make the /etc/rc.d/rc.local file executable.

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

In CentOS7, the permissions of the /etc/rc.d/rc.local file have been reduced, and it is not possible to start some services when booting.

Write the script that needs to be executed into /etc/rc.d/rc.local.

echo "/usr/share/autostartup/demo-service.sh" >> /etc/rc.d/rc.local

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.