SystemD: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
Zeile 43: | Zeile 43: | ||
== Beispiel Service Definitionsdatei == | == Beispiel Service Definitionsdatei == | ||
* /lib/systemd/system/redis.service | |||
<pre>[Unit] | <pre>[Unit] | ||
Description=Redis persistent key-value database | Description=Redis persistent key-value database |
Version vom 25. Januar 2018, 15:20 Uhr
Konfiguration
/etc/systemd/journald.conf
Storage=persistent SystemMaxFileSize=50M
- systemctl restart systemd-journald.service
Kommandos
systemctl
systemctl start nginx.service | stop | status | restart | reload systemctl enable nginx.service | disable systemctl list-units # laufende Services systemctl list-unit-files # verfügbare Services systemctl --failed # missglückte Starts systemctl mask nginx.service # Als nicht startbar markieren systemctl unmask nginx.service # mask aufheben systemctl list-units --type=target systemctl isolate graphical.target | rescue.target | multi-user.target systemctl set-default multi-user.target systemd-analyze systemd-analyze blame # Startzeiten der Services
journalctl
journalctl --since yesterday | --since "2016-03-16 02:00:00" | --since 09:00 --until "1 hour ago" journalctl --list-boots journalctl -b -1 # since last boot (relative pointer -1) journalctl -u nginx.service -u php-fpm.service # by units journalctl -k # kernel messages journalctl --no-full # truncated info journalctl -a # all info journalctl -n 20 # only the last 20 lines journalctl -f # like tail -f journalctl --disk-usage # wie viel braucht das journal journalctl --vacuum-size=1G # Platz auf 1 GByte reduzieren
Beispiel Service Definitionsdatei
- /lib/systemd/system/redis.service
[Unit] Description=Redis persistent key-value database After=network.target [Service] ExecStart=/usr/local/bin/redis-server ExecStop=/usr/local/bin/redis-shutdown WorkingDirectory=/var/lib/redis User=redis Group=redis [Install] WantedBy=multi-user.target