To enable the rc.local
script on a systemd-based Linux system, follow these steps:
systemd
unit file for rc.local
by running the following command:sudo nano /etc/systemd/system/rc-local.service
[Unit] Description=/etc/rc.local Compatibility ConditionPathExists=/etc/rc.local [Service] Type=forking ExecStart=/etc/rc.local start TimeoutSec=0 StandardOutput=tty RemainAfterExit=yes SysVStartPriority=99 [Install] WantedBy=multi-user.target
Save the file and exit the editor.
Run the following command to enable the rc-local
service:
sudo systemctl enable rc-local
rc-local
service by running the following command:sudo systemctl start rc-local
The rc.local
script will now be executed during boot.
Note: The
rc.local
script must be executable. To make it executable, run the following command:
sudo chmod +x /etc/rc.local