Systemd tips and tricks
Jump to navigation
Jump to search
ExecStop[1]
control-group (default) | If set to control-group, all remaining processes in the control group of this unit will be killed on unit stop (for services: after the stop command is executed, as configured with ExecStop=) |
mixed | If set to mixed, the SIGTERM signal (see below) is sent to the main process while the subsequent SIGKILL signal (see below) is sent to all remaining processes of the unit's control group |
process | only the main process itself is killed (not recommended!). |
none | no process is killed. In this case, only the stop command will be executed on unit stop, but no process will be killed otherwise. Processes remaining alive after stop are left in their control group and the control group continues to exist after stop unless empty. (strongly recommended against!). |
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)[2] 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[3] )
/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[4] $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
- ↑ https://www.freedesktop.org/software/systemd/man/latest/
- ↑ https://en.wikipedia.org/wiki/Energy-Efficient_Ethernet
- ↑ https://unix.stackexchange.com/questions/729508/how-to-permanently-disable-eee-energy-efficient-ethernet-on-ethernet-card
- ↑ https://gist.github.com/MrAndrewMal/764e69e35cef7e7b38f05e561d670c9f