Systemd tips and tricks

From HPCWIKI
Jump to navigation Jump to search

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

On system bootup, if dmesg shows following warning,

kernel: igb 0000:01:00.3: exceed max 2 second


We can disable Energy-Efficient Ethernet (EEE)[1] of NIC. 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