Systemd tips and tricks: Difference between revisions

From HPCWIKI
Jump to navigation Jump to search
No edit summary
Line 1: Line 1:
== How to read live-tail logs of multiple services with journalctl ==
== How to read live-tail logs of multiple services with journalctl ==
  #Systemd - How to read live-tail logs of multiple services with journalctl
  #Systemd - How to read live-tail logs of multiple services with journalctl<ref>https://gist.github.com/MrAndrewMal/764e69e35cef7e7b38f05e561d670c9f</ref>
$<ref>https://gist.github.com/MrAndrewMal/764e69e35cef7e7b38f05e561d670c9f</ref>sudo journalctl --follow _SYSTEMD_UNIT=docker.service + _SYSTEMD_UNIT=apache2.service
$sudo journalctl --follow _SYSTEMD_UNIT=docker.service + _SYSTEMD_UNIT=apache2.service


== Ensure the mount path is accessible before the service ==
== Ensure the mount path is accessible before the service ==
  <code>[Unit]
  <[Unit]
  RequiresMountsFor=<path required></code>
  RequiresMountsFor=<path required></code>
This will ensure the path is accessible before starting the service and also will mount it if it's not already (unless it has noauto specified).
This will ensure the path is accessible before starting the service and also will mount it if it's not already (unless it has noauto specified).

Revision as of 10:25, 14 June 2023

How to read live-tail logs of multiple services with journalctl

#Systemd - How to read live-tail logs of multiple services with journalctl[1]
$sudo journalctl --follow _SYSTEMD_UNIT=docker.service + _SYSTEMD_UNIT=apache2.service

Ensure the mount path is accessible before the service

<[Unit]
RequiresMountsFor=<path required>

This will ensure the path is accessible before starting the service and also will mount it if it's not already (unless it has noauto specified).

Reference