[systemd-devel] does "Before=network.target" really work

Andrei Borzenkov arvidjaar at gmail.com
Fri Jun 24 10:23:27 UTC 2016


On Fri, Jun 24, 2016 at 1:11 PM, Xin Long <lucien.xin at gmail.com> wrote:
> Hi,
>
> I have a service, and want it to be stopped only after network is
> stopped when system shutdown.
>
> I checked "man systemd.special ", network is a special internal
> service for systemd, , and I found "network.target":
> "at shutdown, a unit that is ordered after network.target will be
> stopped before the network -- to whatever  level it might be set up
> then -- is shut down".
> That means "After=network.target" can work well.
>
> But my situation is opposite to that, I need "a unit that is ordered
> before network.target will be stopped *after* the network so
> shutdown".
>
> So I added "Before=network.target" to .service file. can it really
> work as I expect?
>

No. That is why systemd was forced to introduce additional
network-pre.target to make it possible to explicitly order things
before networking is started (or stop after networking has been
stopped - assuming of course that all services that implement
networking correct order themselves After network-pre.target).


More information about the systemd-devel mailing list