rc.local unter Ubuntu 17.04 aktivieren

Konfigurationen zu Systemfunktionen von Betriebssystemen. Also alles was nicht in die Kategorie Anwendungsprogramme passt aber zur Softwarekategorie gehört. In der Regel CPU Architektur Übergreifend (ARM, PPC, x86, x64)
Post Reply
User avatar
h3rb3rn
Administrator
Posts: 189
Joined: Mon 9. Feb 2015, 23:29

rc.local unter Ubuntu 17.04 aktivieren

Post by h3rb3rn »

Aktualisierte Fassung vom 26.01.2018

Laut Ubuntu Wiki soll schon seit Version 14.04 die rc.local inaktiv sein => https://wiki.ubuntuusers.de/rc.local/

Abgeleitet aus dem Ubuntu Wiki

Service erstellen:

Code: Select all

sudo vim /etc/systemd/system/multi-user.target.wants/rc-local.service
Inhalt kopieren und einfügen

Code: Select all

[Unit]
Description=/etc/rc.local Compatibility
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
Systemlink erstellen

Code: Select all

sudo ln -s /etc/systemd/system/multi-user.target.wants/rc-local.service /etc/systemd/system/rc-local.service
Erstellen der /etc/rc.local

Code: Select all

sudo vim /etc/rc.local
Inhalt einfügen

Code: Select all

#!/bin/bash 
#
# 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
Hinweis: Es ist darauf zu achten das die erste Zeile der rc.local mit "#!/bin/bash" statt "#!/bin/sh -e" beginnt, da sonst die rc.local beim Bootvorgang nicht korrekt ausgeführt wird!

Datei als ausführbar markieren

Code: Select all

sudo chmod +x /etc/rc.local
Service aktivieren:

Code: Select all

sudo systemctl enable rc-local
Service starten und Status abfragen:

Code: Select all

sudo systemctl start rc-local.service
sudo systemctl status rc-local.service
Post Reply