Systemd

Aus Doku-Wiki
Zur Navigation springenZur Suche springen

Links zu Dokumentationen

Systemd

systemd Startscript

Minimale angaben für ein Systemd-Startscript sind:

vi  /etc/systemd/system/test.service
  • Service Name
[Unit]
Description=test service
  • Start Daemon/Script
[Service]
ExecStart=/usr/local/sbin/test.script
  • Wann wird der Service gestartet

multi-user.target ist der Standard, auch bei Server ohne grafische Oberfläche

[Install]
WantedBy=multi-user.target
  • Ein minimales Startscript sieht also so aus:
[Unit]
Description=test service

[Service]
ExecStart=/usr/local/sbin/test.script

systemctl Befehle

Eine neue Unit aktivieren / deaktivieren / status

sudo systemctl enable NAME_DER_UNIT_DATEI 
sudo systemctl disable NAME_DER_UNIT_DATEI
sudo systemctl is-enabled NAME_DER_UNIT_DATEI

Systemd Unit bearbeiten

sudo systemctl edit --full NAME_DER_UNIT_DATE

[Install]
WantedBy=multi-user.target

Systemd analyze

Mit systemd-analyze lässt sich das System (Bootvorgang) analysieren

systemd-analyze time