Systemctl kurz und knapp: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
| Zeile 1: | Zeile 1: | ||
| + | = systemd Crashkurs = | ||
| + | *Schnelle Übersicht über die wichtigsten Befehle für Service-Management und Targets unter systemd.* | ||
| + | |||
=Listing aller Services= | =Listing aller Services= | ||
*systemctl --type=service | *systemctl --type=service | ||
| + | |||
=Logging eines Dienstes= | =Logging eines Dienstes= | ||
*journalctl -u ssh | *journalctl -u ssh | ||
| + | |||
=Logging eines Dienstes fortlaufend= | =Logging eines Dienstes fortlaufend= | ||
*journalctl -f -u ssh | *journalctl -f -u ssh | ||
| + | |||
=Eigenen Service Unit erstellen= | =Eigenen Service Unit erstellen= | ||
;Service Datei | ;Service Datei | ||
*vi /etc/systemd/system/simple-http.service | *vi /etc/systemd/system/simple-http.service | ||
| − | |||
<pre> | <pre> | ||
[Unit] | [Unit] | ||
| Zeile 29: | Zeile 34: | ||
*systemctl enable simple-http.service | *systemctl enable simple-http.service | ||
*systemctl start simple-http.service | *systemctl start simple-http.service | ||
| + | |||
;Logs lesen | ;Logs lesen | ||
*journalctl -fu simple-http | *journalctl -fu simple-http | ||
| Zeile 34: | Zeile 40: | ||
=Starten eines Service= | =Starten eines Service= | ||
*systemctl start simple-http | *systemctl start simple-http | ||
| + | |||
=Stoppen eines Service= | =Stoppen eines Service= | ||
*systemctl stop simple-http | *systemctl stop simple-http | ||
| + | |||
=Restarten eines Service= | =Restarten eines Service= | ||
*systemctl restart simple-http | *systemctl restart simple-http | ||
| + | |||
=Aktivieren eines Service= | =Aktivieren eines Service= | ||
| − | *systemctl | + | *systemctl enable simple-http |
| + | |||
=Deaktivieren eines Service= | =Deaktivieren eines Service= | ||
*systemctl disable simple-http | *systemctl disable simple-http | ||
| + | |||
=Status eines Service= | =Status eines Service= | ||
*systemctl status simple-http | *systemctl status simple-http | ||
| − | =Set Target= | + | =Set Default Target= |
| − | *systemctl - | + | *systemctl set-default multi-user.target |
| − | *systemctl - | + | *systemctl set-default graphical.target |
| + | |||
=Get Default Target= | =Get Default Target= | ||
*systemctl get-default | *systemctl get-default | ||
| − | + | ||
=Changing Target= | =Changing Target= | ||
| − | *systemctl isolate | + | *systemctl isolate multi-user.target |
| − | |||
| − | |||
| − | |||
=Show Targets= | =Show Targets= | ||
| − | *systemctl list-units --type target | + | *systemctl list-units --type target |
<pre> | <pre> | ||
UNIT LOAD ACTIVE SUB DESCRIPTION | UNIT LOAD ACTIVE SUB DESCRIPTION | ||
Version vom 12. November 2025, 16:09 Uhr
systemd Crashkurs
- Schnelle Übersicht über die wichtigsten Befehle für Service-Management und Targets unter systemd.*
Listing aller Services
- systemctl --type=service
Logging eines Dienstes
- journalctl -u ssh
Logging eines Dienstes fortlaufend
- journalctl -f -u ssh
Eigenen Service Unit erstellen
- Service Datei
- vi /etc/systemd/system/simple-http.service
[Unit] Description=My Miscellaneous Service After=network.target [Service] Type=simple User=xinux WorkingDirectory=/home/xinux/share ExecStart=/bin/python3 -m http.server Restart=on-abort [Install] WantedBy=multi-user.target
- Aktivieren
- systemctl daemon-reload
- systemctl enable simple-http.service
- systemctl start simple-http.service
- Logs lesen
- journalctl -fu simple-http
Starten eines Service
- systemctl start simple-http
Stoppen eines Service
- systemctl stop simple-http
Restarten eines Service
- systemctl restart simple-http
Aktivieren eines Service
- systemctl enable simple-http
Deaktivieren eines Service
- systemctl disable simple-http
Status eines Service
- systemctl status simple-http
Set Default Target
- systemctl set-default multi-user.target
- systemctl set-default graphical.target
Get Default Target
- systemctl get-default
Changing Target
- systemctl isolate multi-user.target
Show Targets
- systemctl list-units --type target
UNIT LOAD ACTIVE SUB DESCRIPTION basic.target loaded active active Basic System bluetooth.target loaded active active Bluetooth ceph-mds.target loaded active active ceph target allowing to start/stop all ceph-mds@.service instances at once ceph-mon.target loaded active active ceph target allowing to start/stop all ceph-mon@.service instances at once ...