Unter Debian 9 ist die traditionelle rc.local
veraltet. Für traditionelle Linux-Benutzer und -Administratoren gibt es eine Möglichkeit, es mit SystemD zurückzubekommen.
Zuerst bearbeiten/erstellen wir die nicht vorhandene Datei „rc-local.service“.
root:~# vi /etc/systemd/system/rc-local.service
Nun fügen wir folgenden Ihnalt zu /etc/systemd/system/rc-local.service
hinzu.
[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
Nun erstellen wir die Datei /etc/rc.local
.
root:~# vi /etc/rc.local
Folgenden generischen Inhalt tragen wir in der Datei /etc/rc.local
ein. Wichtig ist am Ende das exit 0
.
#!/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
Nun noch die Berechtigungen anpassen.
root:~# chmod +x /etc/rc.local
Dann das rc-local
Skript zum booten aktivieren.
root:~# systemctl enable rc-local
Dann den rc-local
Service starten.
root:~# systemctl start rc-local.service
Nun noch prüfen, ob beim start des Dienstes Fehler auftreten.
root:~# systemctl status rc-local.service