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