RC is the abbreviation for RunLevel control directory.
In most Linux distributions, startup scripts are placed in/ETC/RC.D/INIT.D. These scripts are connected to the/ETC/RC.D/RCN.D directory by the LN command. (Here's n is run level 0-6)
init.d/: A directory of binary files for various servers and programs.
Rcx.d/: The execution Program connection directory at each startup level. Everything inside is a soft connection to the init.d/.
There are three more scripts: Rc.sysinit, RC, rc.local
The starting and executing order of the Redhat is:
Load Kernel execute init program/etc/rc.d/rc.sysinit # The first script executed by Init
/ETC/RC.D/RC $RUNLEVEL # $RUNLEVEL is the default run mode
/etc/rc.d/rc.local/sbin/mingetty # Waiting for user login
/etc/rc.d/rc.sysinit mainly do the same initialization work in various running modes, including: dial-in Keymap and system font startup swapping setting hostname setting NIS domain name check (fsck) and Mount file system open Quota load sound card The module sets the system clock and so on.
/ETC/RC.D/RC the running mode (run level, which you can set in the Inittab file) according to its parameters to execute the script in the corresponding directory.
Those who start with the kxx are called by the Stop argument, and all start with the sxx as arguments. The order of the calls is performed in XX from small to large.
For example, suppose that the default run mode is 3,/ETC/RC.D/RC, and the script under/etc/rc.d/rc3.d/is invoked in the way described above.
It is worth mentioning that the run mode 2, 3, and 5 in Redhat are the last of the initialization scripts, so users can add to the file the commands they need to execute before they log on after other initialization work. When Init waits for the/ETC/RC.D/RC to execute (because the action in/etc/inittab is wait), it runs/sbin/mingetty on the specified virtual terminals, waiting for the user to log on.
Fedora Set up boot script
sudo touch/etc/rc.d/rc.local
sudo vim/etc/rc.d/rc.local
Write in the/etc/rc.d/rc.local file and use the following: Wq command to save and exit.
#!/bin/bash
# write in this file the command to be executed at boot up
To give executable permission:
sudo chmod+x/etc/rc.d/rc.local
To set the boot boot:
sudo systemctl enable Rc-local.service
If you receive the following error message:
[Root@abc ~]# Systemctl Enable Rc-local.service
The unit's files have no [Install] section. They are not meant to is enabled
Using Systemctl.
Possible reasons for has this kind of units are:
1) A May is statically enabled by being symlinked to another unit ' s
. wants/or. Requires/directory.
2) A Unit's purpose may is to act as A helper for some other which has
A requirement dependency on it.
3) A unit May is started when needed via activation (socket, path, timer,
D-bus, Udev, scripted systemctl call, ...).
sudo vim/usr/lib/systemd/system/rc-local.service the end of the Rc-local.service file by adding:
[Install]
Wantedby=multi-user.target
and reset the boot up:
sudo systemctl enable Rc-local.service
View status, if the following prompts, the setting is successful!