[systemd-devel] Antw: Re: Service fails to start with no log messages

Reindl Harald h.reindl at thelounge.net
Mon Jan 13 10:50:42 UTC 2020



Am 13.01.20 um 11:45 schrieb Ulrich Windl:
>>>> Lennart Poettering <lennart at poettering.net> schrieb am 07.01.2020 um 14:27
>> Such a concept does not exist. I mean your service is a system
>> service itself, so what is that even supposed to mean that the service
>> shall start 5s after it already started? But even if you mean to say
>> "5s after all other services", then think how that falls apart if you
>> have multiple services declaring that.
> 
> Maybe explain when systemd considers a service as started, pointing out wrong
> implementations.

https://www.freedesktop.org/software/systemd/man/systemd.service.html

CTRL+F Type=

for network it strongly depends on *how* your network is setup
(NetworkManager, systemd-networkd, legacy /etc/nint.d/network or even a
own implementation)

with the implementation below you can relieable oder anything after
"network-up.service" or "network-online.target"

[root at master:~]$ cat /etc/systemd/system/network-up.service
##############################################################
#  Device-Naming: /etc/udev/rules.d/70-persistent-net.rules  #
##############################################################

[Unit]
Description=Network
After=sys-subsystem-net-devices-eth0.device
Wants=sys-subsystem-net-devices-eth0.device
Before=crond.service timers.target disk-timeout.service vmtoolsd.service
PartOf=network-online.target

[Service]
Type=oneshot
RemainAfterExit=yes
SuccessExitStatus=80

# Firewall-Regeln laden
ExecStart=/usr/sbin/iptables-legacy-restore -w 5 /etc/sysconfig/iptables

# Conntrack-Konfiguration aktualisieren
ExecStart=-/usr/sbin/sysctl -q --load=/etc/sysctl-conntrack.conf

# NIC-Konfiguration (https://kb.vmware.com/s/article/2151480)
ExecStart=-/usr/sbin/ethtool -G eth0 rx-mini 0

# LAN-Interface konfiguieren
ExecStart=/usr/sbin/ip addr add 10.0.0.102/255.255.255.0 broadcast
10.0.0.255 dev eth0
ExecStart=/usr/sbin/ip link set dev eth0 multicast off up

# Default-Gateway setzen
ExecStart=/usr/sbin/ip route add default via 10.0.0.1

# Sicherstellen dass 'sysctl' nachdem alle Netzwerk-Devices
initialisiert wurden angewendet wird
ExecStart=-/usr/sbin/sysctl -e -p -q

[Install]
WantedBy=network-online.target
WantedBy=multi-user.target


More information about the systemd-devel mailing list