Boot Time
The /etc/rc.d/rc.local
script is executed by the init command
at boot time or when changing runlevels. Adding commands to the bottom of
this script is an easy way to perform necessary tasks like starting special
services or initialize devices without writing complex initialization scripts
in the /etc/rc.d/init.d/
directory and creating symbolic links.
The /etc/rc.serial
script is used if serial ports must be setup
at boot time. This script runs setserial commands to configure the system's
serial ports. Refer to the setserial man page for more information.
On CentOS 7.2, the script /etc/rc.d/rc.local
has the following
note:
#!/bin/bash # THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES # # It is highly advisable to create own systemd services or udev rules # to run scripts during boot instead of using this file. # # In contrast to previous versions due to parallel execution during boot # this script will NOT be run after all other services. # # Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure # that this script will be executed during boot. touch /var/lock/subsys/local
systemd is an init system used by some Linux distributions to bootstrap the user space and manage all processes subsequently, instead of the UNIX System V or Berkeley Software Distribution (BSD) init systems. The name systemd adheres to the Unix convention of naming daemons by appending the letter d. It is published as free and open-source software under the terms of the GNU Lesser General Public License (LGPL) version 2.1 or later. One of systemd's main goals is to unify basic Linux configurations and service behaviors across all distributions.
Create a Directory
If you need to have a directory created during boot up, place a text
file in the directory /etc/tmpfiles.d
. This file will contain the necessary information needed to create the directory, assign the appropriate permissions and access. See tmpfiles.d(5) for more information.
The following is the layout of the file.
Type Path Mode UID GID Age Argument
Example:
d /run/reo 0775 - -