How To Use Etc Rc Local

You might use it to start a custom service for example a server that s installed in usr local.
How to use etc rc local. Type the following command in order to switch to the root user you will need to type in a password when prompted. Sudo chmod x etc rc local. In centos rhel 7 the etc rc d rc local file is controlled by rc local service. It is traditionally executed after all the normal system services are started at the end of the process of switching to a multiuser run level. Finally enable the service on system boot.
Next run the following command to make sure etc rc local file is executable. The script etc rc local is for use by the system administrator. Third grant execute access rights to the rc. Add commands below the comment but leave the line exit 0 at the end then save the file and exit. That s the content of ubuntu 16 04 s stock etc rc local file.
Sudo su systemctl status rc local. On your pi edit the file etc rc local using the editor of your choice. You will learn how to enable etc rc local on ubuntu 20 04 focal fossa during startup. First you need to create etc rc local file if it doesn t exists. Make sure etc rc local file is executable.
Just paste your commands above the line that says exit 0. You must edit with root for example. If you enable etc rc local to run on system boot using the command. Sudo chmod x etc rc local. To save a file in nano text editor press ctrl o then press enter to confirm.
Open the terminal on ubuntu. You can now use this file to execute commands at system boot. Bin bash add your script or command here example route add net 192 168 0 0 24 gw 192 168 0 100 exit 0 step 3 grant execute access file rc local. Sudo i nano etc rc local step 2 fill with bash script in the rc local file. Second please fill in the rc local file using bash script.