This article explains how to create rc.local file in Linux Debian 9
Steps on how to add rc.local in Debian 9 can be found below.
On Debian 9, the traditional “rc.local” has been eliminated. For traditional Linux users and administrators, there is a way to get it back using SystemD. See the procedure below (NOTE: all commands must be run with root privileges):
1. Edit the non-existing file “rc-local.service” :
vi /etc/systemd/system/rc-local.service
1.1. Add the following content to “/etc/systemd/system/rc-local.service” :
[Unit]
Description=/etc/rc.local
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
2. Edit the “rc.local” file :
vi /etc/rc.local
2.1. Add the content below and save the file
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
exit 0
3. Change permissions
chmod +x /etc/rc.local
4. Enable the “rc-local” script on boot
systemctl enable rc-local
5. Start the “rc-local” script
systemctl start rc-local.service
6. Check if any error occurred while starting the service
systemctl status rc-local.service
You may now append anything you’d like to the traditional “rc.local”. Similar procedure can be applied to Debian based distros like Ubuntu, Elementary or Kali.
Please report any broken links by emailing support@elotouch.com and include a link to the knowledge article