2
1
The unit file for that is supposed to be like that:
[Unit]
Description=@CPACK_PACKAGE_DESCRIPTION_SUMMARY@
Before=network-pre.target
Wants=network-pre.target
[Service]
Type=oneshot
ExecStart=/sbin/my-script.sh
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target
It's according to http://www.freedesktop.org/wiki/Software/systemd/NetworkTarget/
Services that want to be run before the network is configured should place Before=network-pre.target and also set Wants=network-pre.target to pull it in.
But it stops the networking service from running at all.
Possible duplicate: https://unix.stackexchange.com/questions/229048/how-to-start-a-systemd-service-before-networking-starts
– Josip Rodin – 2017-06-11T19:01:39.470