How to enable rc.local shell script on systemd while booting Linux system
To enable an rc.local shell script on a systemd-based Linux system during boot, you can follow these steps:
- Create a file named "rc-local.service" in the "/etc/systemd/system" directory.
- Open the file in your text editor and paste the following content:
Description=/etc/rc.local compatibilityrnrn
Type=forkingrnExecStart=/etc/rc.local startrnTimeoutSec=0
StandardOutput=ttyrnRemainAfterExit=yesrnSysVStartPriority=99
WantedBy=multi-user.target- Make the file executable by running the command "sudo chmod +x /etc/systemd/system/rc-local.service"
- Create a file named "/etc/rc.local" and add the commands you want to be executed on startup. Make sure the file is executable by running the command "sudo chmod +x /etc/rc.local"
- Enable the rc-local service by running the command "sudo systemctl enable rc-local"
- Start the service by running the command "sudo systemctl start rc-local"
- Verify the status of the service by running the command "sudo systemctl status rc-local"
