On Debian 9, the traditional “rc.local” has been deprecated. For traditional Linux users and administrators, there is a way to get it back using SystemD. See the procedure below :
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. Append the generic 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”.