Enabling rc.local in Debian 9.4 (Stretch)

rc.local has been deprecated in Debian 9.

However, you can still enable it with the following steps.

Create a new file /etc/rc.local

Add the following lines:

#!/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

Make rc.local executable

chmod +x /etc/rc.local

Enable rc.local

systemctl enable rc-local

Start the service:

systemctl start rc-local.service

Get the service status:

systemctl status rc-local.service

If successful, the status output should look like this:

systemctl status rc-local.service
● rc-local.service - /etc/rc.local Compatibility
   Loaded: loaded (/lib/systemd/system/rc-local.service; static; vendor preset: enabled)
  Drop-In: /lib/systemd/system/rc-local.service.d
   Active: active (running) since Tue 2018-07-31 09:37:33 BST; 3h 49min ago
  Process: 522 ExecStart=/etc/rc.local start (code=exited, status=0/SUCCESS)

admin has written 99 articles