Systemd tips and tricks: Difference between revisions

From HPCWIKI
Jump to navigation Jump to search
No edit summary
Line 1: Line 1:
== How to permanently disable EEE (Energy Efficient Ethernet) on network card ==
'''Energy-Efficient Ethernet''' ('''EEE''') is a set of enhancements<ref>https://en.wikipedia.org/wiki/Energy-Efficient_Ethernet</ref>. To disable EEE on network card we can use systemd service unit to run the ethtool command (e.g. /etc/systemd/system/disable-eee.service<ref>https://unix.stackexchange.com/questions/729508/how-to-permanently-disable-eee-energy-efficient-ethernet-on-ethernet-card</ref> )<syntaxhighlight lang="bash">
/etc/systemd/system/disable-eee.service
Description=HM disable eee on NIC
Before=network-pre.target
Wants=network-pre.target
[Service]
Type=oneshot
RemainAfterExit=true
ExecStartPre=/usr/sbin/ethtool --set-eee eno1 eee off
ExecStart=/usr/sbin/ethtool --set-eee eno2 eee off
[Install]
WantedBy=multi-user.target
</syntaxhighlight>
== 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<ref>https://gist.github.com/MrAndrewMal/764e69e35cef7e7b38f05e561d670c9f</ref>
  #Systemd - How to read live-tail logs of multiple services with journalctl<ref>https://gist.github.com/MrAndrewMal/764e69e35cef7e7b38f05e561d670c9f</ref>
Line 5: Line 23:
== Ensure the mount path is accessible before the service ==
== Ensure the mount path is accessible before the service ==
  <[Unit]
  <[Unit]
  RequiresMountsFor=<path required></code>
  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).
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 ==
== Reference ==
<references />
<references />

Revision as of 11:05, 4 January 2024

How to permanently disable EEE (Energy Efficient Ethernet) on network card

Energy-Efficient Ethernet (EEE) is a set of enhancements[1]. To disable EEE on network card we can use systemd service unit to run the ethtool command (e.g. /etc/systemd/system/disable-eee.service[2] )

/etc/systemd/system/disable-eee.service

Description=HM disable eee on NIC
Before=network-pre.target
Wants=network-pre.target

[Service]
Type=oneshot
RemainAfterExit=true
ExecStartPre=/usr/sbin/ethtool --set-eee eno1 eee off
ExecStart=/usr/sbin/ethtool --set-eee eno2 eee off

[Install]
WantedBy=multi-user.target

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

#Systemd - How to read live-tail logs of multiple services with journalctl[3]
$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